private BlendedCameraBehavior AddNewBehavior(GameCameraBehavior newGameCamera, CameraLerp lerp) { if (GetNewestRunningBehaviorIndex() >= 0) // if there are any behaviors currently { if (GameCameraBehavior.AreInputParametersEqual(_runningBehaviors[GetNewestRunningBehaviorIndex()].behavior, newGameCamera)) // are we trying to add an exact same behavior? { return(null); // no need to add a duplicate } if (BlendedCameraBehavior.IsTransitionImmediate(lerp)) // if it is a cut { _runningBehaviors.Clear(); // can remove everything currently in the list as it will not effect output after cutting to new camera } } BlendedCameraBehavior newRunningBehavior = new BlendedCameraBehavior(lerp, newGameCamera); _runningBehaviors.Add(newRunningBehavior); #if UNITY_EDITOR if (null != theEditor) { theEditor.Repaint(); } #endif return(newRunningBehavior); }
public override BlendedCameraBehavior EnterInteractionCamera(ref List <GameObject> targets, ref GameCameraParams gameCamParams, CameraLerp lerp) { _curCameraMotion = base.EnterInteractionCamera(ref targets, ref gameCamParams, lerp); //_runningBehaviors[1].behavior.SetRotation(targets[0].transform.rotation); return(null); }
public void EnterFixedOffsetGameCamera(CameraLerp lerp) { if (BlendedCameraBehavior.IsTransitionImmediate(lerp)) { _runningBehaviors.Clear(); } AddNewBehavior(_gameCamera, lerp); }
public void ResetCameraState() { ShowMainMenu(); if (_curCameraMotion != null) { //remove curCameraMotion if (_runningBehaviors != null && _runningBehaviors.Count > 0) { for (int i = _runningBehaviors.Count - 1; i >= 0; i--) { if (_runningBehaviors[i] == _curCameraMotion) { _runningBehaviors.RemoveAt(i); } } } //RemoveThisBehavior(_curCameraMotion); _curCameraMotion = null; } }
protected void RemoveThisBehavior(BlendedCameraBehavior thisBehavior) { _runningBehaviors.Remove(thisBehavior); }