コード例 #1
0
        public void EnterState(int stateId)
        {
            if (currentState != null && currentState.stateId == stateId)
            {
                // 状态相同
                return;
            }

            FSMStateBase <T> targetState = stateDic.GetValue(stateId);

            if (currentState != null)
            {
                currentState.Exit(actor);
            }
            currentState = targetState;
            currentState.Enter(actor);
        }
コード例 #2
0
 public void RegisterState(FSMStateBase <T> state)
 {
     stateDic.Add(state.stateId, state);
 }