public void MoveToState(StateId state) { currentState.OnStateExit(); m_preStateId = m_curStateId; m_curStateId = state; preState = currentState; currentState = CreateState(state); currentState.OnStateEnter(); }
protected override FSMState CreateState(StateId state) { switch (state.GetId()) { case CVAnimState.Idle: { //return new AnimIdleFS(this, m_beingEntity); return new AnimIdleFS(this, m_card); } case CVAnimState.Walk: { //return new AnimWalkFS(this, m_beingEntity); return new AnimWalkFS(this, m_card); } case CVAnimState.Run: { //return new AnimRunFS(this, m_beingEntity); return new AnimRunFS(this, m_card); } default: return null; } }
protected override FSMState CreateState(StateId state) { switch (state.GetId()) { case (int)SceneState.eInplace: { return new InplaceFS(this, m_card); } case (int)SceneState.eInplace2DestStart: { return new Inplace2DestStartFS(this, m_card); } case (int)SceneState.eInplace2Desting: { return new Inplace2DestingFS(this, m_card); } case (int)SceneState.eInplace2Dested: { return new Inplace2DestedFS(this, m_card); } case (int)SceneState.eAttackStart: { return new AttackStartFS(this, m_card); } case (int)SceneState.eAttacking: { return new AttackingFS(this, m_card); } case (int)SceneState.eAttacked: { return new AttackedFS(this, m_card); } case (int)SceneState.eDest2InplaceStart: { return new Dest2InplaceStartFS(this, m_card); } case (int)SceneState.eDest2Inplaceing: { return new Dest2InplaceingFS(this, m_card); } case (int)SceneState.eDest2Inplaced: { return new Dest2InplacedFS(this, m_card); } case (int)SceneState.eHurtStart: { return new HurtStartFS(this, m_card); } case (int)SceneState.eHurting: { return new HurtingFS(this, m_card); } case (int)SceneState.eHurted: { return new HurtedFS(this, m_card); } default: { return null; } } }
public bool equalCurState(StateId state) { return m_curStateId.GetId() == state.GetId(); }
public virtual void InitFSM() { m_curStateId = AnimStateId.ASIDLE; currentState = CreateState(AnimStateId.ASIDLE); }
protected abstract FSMState CreateState(StateId state);
protected override FSMState CreateState(StateId state) { return null; }
public bool equalCurState(StateId state) { return(m_curStateId.GetId() == state.GetId()); }