public MFSM(E_Monster monster) { m_monster = monster; m_autoMove = new MFSMS_AutoMove(this); m_autoBattle = new MFSMS_AutoBattle(this); m_castFront = new MFSMS_CastFront(this); m_castBack = new MFSMS_CastBack(this); m_faint = new MFSMS_Faint(this); m_dead = new MFSMS_Dead(this); m_curState = m_autoMove; m_curState.OnEnter(monster, MFSMStateType.DEAD); }
public void Tick(float dT) { m_curState.OnTick(m_monster, dT); MFSMStateBase nextState = m_curState.GetNextState(m_monster); if (nextState != null) { // 自动转移 m_curState.OnExit(m_monster, nextState.m_Type); nextState.OnEnter(m_monster, m_curState.m_Type); m_curState = nextState; } }