public void SwitchState(EnemyBaseState newstate) { ExitState(); newstate.EnterState(); _ctx.currentState = newstate; }
public void TransitionToState(EnemyBaseState state) { // Set current state field to the param. currentState = state; //call enter state message as "this" current instance of the fsm class. currentState.EnterState(this); }
/// <summary> /// 切换状态的方法 /// </summary> /// <param name="state">传入一个状态机对象切换敌人的状态,切换之后进入该状态</param> public void TransitionToState(EnemyBaseState state) { // 切换状态 当前状态 = 传入的状态 _currentState = state; // 切换之后敌人进入当前状态 _currentState.EnterState(this); }
public void SetEnemyState(EnemyBaseState newState) { if (currentState != null) { currentState.ExitState(this); } currentState = newState; currentState.EnterState(this); }
public void TransitionToState(EnemyBaseState state) { currentState = state; currentState.EnterState(this); }
public void TransitionToState(EnemyBaseState state) //状态机切换 { currentState = state; //进入状态方法 currentState.EnterState(this); }