Exemplo n.º 1
0
 public override void ChangeAIState <T>(AIStateType stateType)
 {
     if (AIStateType != stateType)
     {
         AIStateType = stateType;
         ActorFsmStateBase state = m_Fsm.GetState <T>();
         state.ChangeState <T>();
     }
 }
Exemplo n.º 2
0
        public virtual void ChangeState <T>(ICommand command = null) where T : ActorFsmStateBase
        {
            if (m_ActorFsm == null)
            {
                Log.Error("Please set ActorFsm first");
                return;
            }

            if (!m_ActorFsm.HasState <T>())
            {
                Log.Error("Can no find state" + typeof(T));
                return;
            }

            ActorFsmStateBase state = m_ActorFsm.GetState <T>();

            if (CurFsmStateType == ActorFsmStateType.FSM_DEAD && state.StateType != ActorFsmStateType.FSM_REBORN)
            {
                return;
            }

            m_ActorFsm.GetState <T>().SetCommand(command);
            state.ChangeState <T>();
        }