private void ChangeToState(CharactorState state) { if (CurrentState != state) { CurrentState = state; } }
// Start is called before the first frame update void Start() { // CharactorControllerのコンポーネントを取得 _Controller = GetComponent <CharacterController>(); // CharactorStateの初期化 _CharactorState = CharactorState.STATE_NORMAL; // 初期値を表に設定 TMPAerial = GameObject.Find("Aerial"); }
public ECharactorState GetOldState() { CharactorState charactorState = m_pMachine.PreviousState() as CharactorState; if (charactorState != null) { return(charactorState.m_eState); } return(ECharactorState.EPS_Max); }
public ECharactorState GetCurrentState() { CharactorState charactorState = m_pMachine.CurrentState() as CharactorState; if (charactorState != null) { return(charactorState.m_eState); } return(ECharactorState.EPS_Max); }
// メンバ関数 //************************************************ // キャラクターのステートセットする関数 // 引数には列挙型を入れる // // public enum CharactorState // { // STATE_NORMAL, // 通常状態 // STATE_WARP, // ワープ状態 // }; //************************************************ public void SetState(CharactorState s) { // 現在のステートを変更 this._CharactorState = s; // 各状態ごとの初期処理 if (s == CharactorState.STATE_NORMAL) // 通常状態 { _Controller.enabled = true; // CharactorController有効化 } else if (s == CharactorState.STATE_WARP) // ワープ状態 { _Controller.enabled = false; // CharactorController無効化 _MoveDirection = Vector3.zero; // 移動量をゼロにする } }