protected virtual bool LockOn() { if (currentCharaInfo) { var targets = CameraTargetManager.GetTargetManager(currentCharaInfo).GetTargets(); if (shouldResetLock) { shouldResetLock = false; return(LockOn(targets[0])); } if (reduceOffset == true) { CameraTargetPos += targetOffsetSize; targetOffsetSize = new Vector3(); } else if (targetOffsetSize.magnitude > 0f) { reduceOffset = true; return(true); } if (!lockOnTarget) { return(LockOn(targets[0])); } else { for (int i = 0; i < targets.Count; i++) { if (lockOnTarget == targets[i]) { int next = i + 1 > targets.Count - 1 ? 0 : i + 1; return(LockOn(targets[next])); } } return(LockOn(targets[0])); } } return(false); }
protected virtual bool LockOn(string targetName, bool lockOnAnyway = false, bool resetOffset = true) { foreach (var target in CameraTargetManager.GetTargetManager(currentCharaInfo).GetTargets()) { if (target.name == targetName) { if (LockOn(target, resetOffset)) { return(true); } } } if (lockOnAnyway) { if (LockOn()) { return(true); } } return(false); }