Skip to content

Commit

Permalink
Merge pull request #19 from KynraiT/patch-1
Browse files Browse the repository at this point in the history
Character for PoV rotates on toggle
  • Loading branch information
Keelhauled committed Jan 7, 2021
2 parents e22b1fb + d38e0f1 commit e7ef1bd
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/RealPOV.Koikatu/RealPOV.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using BepInEx;
using BepInEx;
using HarmonyLib;
using RealPOV.Core;
using Studio;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

Expand All @@ -16,8 +17,8 @@ public class RealPOV : RealPOVCore

private static int backupLayer;
private static ChaControl currentChara;
private static Queue<ChaControl> charaQueue;
private bool isStudio = Paths.ProcessName == "CharaStudio";
private bool enteringMessageShown = false;

protected override void Awake()
{
Expand All @@ -37,22 +38,18 @@ internal override void EnablePOV()
}
else
{
var cameraTarget = GameObject.Find("HScene/CameraBase/Camera/CameraTarget");
if(cameraTarget)
if(charaQueue == null)
{
currentChara = FindObjectsOfType<ChaControl>().OrderBy(x => Vector3.Distance(cameraTarget.transform.position, x.neckLookCtrl.transform.position)).First();
if (currentChara)
{
if(!enteringMessageShown)
{
Logger.LogMessage("Entering POV of character closest to camera center. Move camera to select other characters.");
enteringMessageShown = true;
}
}
else
{
Logger.LogMessage("No characters found. Move camera center close to a character to enter its POV.");
}
charaQueue = new Queue<ChaControl>();
foreach (ChaControl chara in FindObjectsOfType<ChaControl>())
charaQueue.Enqueue(chara);
currentChara = charaQueue.Dequeue();
charaQueue.Enqueue(currentChara);
}
else
{
currentChara = charaQueue.Dequeue();
charaQueue.Enqueue(currentChara);
}
}

Expand Down

0 comments on commit e7ef1bd

Please sign in to comment.