コード例 #1
0
ファイル: FSM.cs プロジェクト: Xujintao0519/CosmosFramework
        public void ChangeState(Type stateType)
        {
            if (currentState == null)
            {
                Utility.DebugError("Current state is invalid");
            }
            FSMState <T> state = null;

            state = GetState(state.GetType());
            if (state == null)
            {
                Utility.DebugError("FSM" + currentState.ToString() + " can not change state to " + state.ToString() + " which is not exist");
            }
            currentState.OnExit(this);
            currentState = state;
            currentState.OnEnter(this);
        }
コード例 #2
0
ファイル: FSM.cs プロジェクト: takaaptech/CosmosFramework
        public void ChangeState(Type stateType)
        {
            if (currentState == null)
            {
                throw new ArgumentNullException("Current state is invalid");
            }
            FSMState <T> state = null;

            //state = GetState(state.GetType());
            state = GetState(stateType);
            if (state == null)
            {
                throw new ArgumentNullException("FSM" + currentState.ToString() + " can not change state to " + state.ToString() + " which is not exist");
            }
            currentState.OnExit(this);
            currentState = state;
            currentState.OnEnter(this);
        }