public bool Transit(APlayerState toState) { //TODO:[Gafgar: Sat/01-02-2020] implement recursive guard! if (toState.CanEnter(this, mState)) { mState.Exit(this, toState); var oldState = mState; mState = toState; mState.Enter(this, oldState); return(true); } return(false); }
} //[Gafgar: Sat/01-02-2020]: not sure if we want this? We can just go with a character controller right? private void Awake() { m_LoadData.Ctrl = GetComponent <CharacterController>(); m_LoadData.Cam = GetComponentInChildren <Camera>(); mLeanPos.y = 3; mCameraStartOffset = mCameraOffset = Ctrl.transform.InverseTransformPoint(Cam.transform.position); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; APlayerState[] states = GetComponents <APlayerState>(); foreach (var sate in states) { sate.Setup(this); } if (mState) { mState.Enter(this, null); } _statusGUI = GetComponentInChildren <StatusGUI>(); }