public virtual void Set_State(FreeLookCameraState profile) { Pivot.localPosition = profile.PivotPos; Cam.transform.localPosition = profile.CamPos; Cam.fieldOfView = ActiveFOV = profile.CamFOV; OnStateChange.Invoke(); }
internal void SetState(FreeLookCameraState state, bool temporal) { if (state == null) { return; } NextState = state; if (currentState && NextState == currentState) { return; } if (IChangeStates != null) { StopCoroutine(IChangeStates); } if (!temporal) { DefaultState = state; //Changes wth this } IChangeStates = StateTransition(state.transition); StartCoroutine(IChangeStates); }
private void SetState(FreeLookCameraState state, bool temporal) { if (state == null) { return; } if (mCamera == null) { return; } mCamera.SetState(state, temporal); }
private void UpdateState(FreeLookCameraState state) { if (state == null) { return; } Pivot.localPosition = state.PivotPos; CamT.localPosition = state.CamPos; Cam.fieldOfView = ActiveFOV = state.CamFOV; OnStateChange.Invoke(); }
public void SetCamera(MFreeLookCamera Freecamera) { mCamera = Freecamera; if (mCamera) { cam = mCamera.Cam.GetComponent <Camera>(); } ChangeStates = StateTransition(transition); currentState = null; NextState = null; Mounted = null; MountedTarget = null; }
protected void Awake() { Cam = GetComponentInChildren <Camera>(); CamT = GetComponentInChildren <Camera>().transform; Pivot = Cam.transform.parent; currentState = null; NextState = null; if (manager) { manager.SetCamera(this); } if (DefaultState) { Set_State(DefaultState); } Cursor.lockState = m_LockCursor ? CursorLockMode.Locked : CursorLockMode.None; // Lock or unlock the cursor. Cursor.visible = !m_LockCursor; m_PivotEulers = Pivot.rotation.eulerAngles; m_PivotTargetRot = Pivot.transform.localRotation; m_TransformTargetRot = transform.localRotation; ActiveFOV = Cam.fieldOfView; inputSystem = DefaultInput.GetInputSystem(PlayerID); Horizontal.InputSystem = Vertical.InputSystem = inputSystem; //Update the Input System on the Axis defaultUpdate = updateType; if (DefaultState == null) { // FreeLookCameraState defaault = ScriptableObject.CreateInstance< new FreeLookCameraState(Cam.fieldOfView, Pivot.localPosition, CamT.localPosition); DefaultState = ScriptableObject.CreateInstance <FreeLookCameraState>(); DefaultState.CamFOV = Cam.fieldOfView; DefaultState.PivotPos = Pivot.localPosition; DefaultState.CamPos = CamT.localPosition; DefaultState.name = "Default State"; OnStateChange.Invoke(); } }
void UpdateState(FreeLookCameraState state) { if (mCamera == null) { return; } if (state == null) { return; } mCamera.Pivot.localPosition = state.PivotPos; mCamera.Cam.localPosition = state.CamPos; mCamera.Cam.GetComponent <Camera>().fieldOfView = state.CamFOV; }
IEnumerator StateTransition(float time) { inTransition = true; float elapsedTime = 0; currentState = NextState; while (elapsedTime < time) { mCamera.Pivot.localPosition = Vector3.Lerp(mCamera.Pivot.localPosition, NextState.PivotPos, Mathf.SmoothStep(0, 1, elapsedTime / time)); mCamera.Cam.localPosition = Vector3.Lerp(mCamera.Cam.localPosition, NextState.CamPos, Mathf.SmoothStep(0, 1, elapsedTime / time)); mCamera.Cam.GetComponent <Camera>().fieldOfView = Mathf.Lerp(mCamera.Cam.GetComponent <Camera>().fieldOfView, NextState.CamFOV, Mathf.SmoothStep(0, 1, elapsedTime / time)); elapsedTime += Time.deltaTime; yield return(null); } UpdateState(NextState); inTransition = false; }
private IEnumerator StateTransition(float time) { float elapsedTime = 0; currentState = NextState; while (elapsedTime < time) { Pivot.localPosition = Vector3.Lerp(Pivot.localPosition, NextState.PivotPos, Mathf.SmoothStep(0, 1, elapsedTime / time)); CamT.localPosition = Vector3.Lerp(CamT.localPosition, NextState.CamPos, Mathf.SmoothStep(0, 1, elapsedTime / time)); Cam.fieldOfView = ActiveFOV = Mathf.Lerp(Cam.fieldOfView, NextState.CamFOV, Mathf.SmoothStep(0, 1, elapsedTime / time)); OnStateChange.Invoke(); elapsedTime += Time.deltaTime; yield return(null); } UpdateState(NextState); NextState = null; yield return(null); }
public void SetCameraState(FreeLookCameraState state) { if (mCamera == null) { return; } if (state == null) { return; } NextState = state; if (currentState && NextState == currentState) { return; } mCamera.StopCoroutine(ChangeStates); ChangeStates = StateTransition(transition); mCamera.StartCoroutine(ChangeStates); }
public void SetCameraState(FreeLookCameraState state) { if (mCamera == null) { return; } if (state == null) { return; } NextState = state; if (currentState && NextState.Name == currentState.Name) { return; } StopAllCoroutines(); StartCoroutine(StateTransition(transition)); }
public void SetAimRight(FreeLookCameraState state) => AimRight = state;
public void SetAimLeft(FreeLookCameraState state) => AimLeft = state;
public void Set_State_Smooth(FreeLookCameraState state) { SetState(state, false); }
public virtual void SetState(FreeLookCameraState profile) { Pivot.localPosition = profile.PivotPos; Cam.localPosition = profile.CamPos; Cam.GetComponent <Camera>().fieldOfView = profile.CamFOV; }
public void Set_State_Temporal(FreeLookCameraState state) { SetState(state, true); }
public virtual void SetTemporalState(FreeLookCameraState state) => SetState(state, true);
public virtual void SetState(FreeLookCameraState state) => SetState(state, false);
public virtual void SetStateInstant(FreeLookCameraState state) { mCamera.SetState_Instant(state, false); }
void Start() { currentState = Default; UpdateState(currentState); }
private void SetState(FreeLookCameraState state, bool temporal) => mCamera?.SetState(state, temporal);
public void SetMounted(FreeLookCameraState state) { Mounted = state; SetCameraState(Mounted); }