예제 #1
0
    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);
 }
예제 #3
0
파일: Enemy.cs 프로젝트: soulhez/PirateBomb
 /// <summary>
 /// 切换状态的方法
 /// </summary>
 /// <param name="state">传入一个状态机对象切换敌人的状态,切换之后进入该状态</param>
 public void TransitionToState(EnemyBaseState state)
 {
     // 切换状态 当前状态 = 传入的状态
     _currentState = state;
     // 切换之后敌人进入当前状态
     _currentState.EnterState(this);
 }
예제 #4
0
 public void SetEnemyState(EnemyBaseState newState)
 {
     if (currentState != null)
     {
         currentState.ExitState(this);
     }
     currentState = newState;
     currentState.EnterState(this);
 }
예제 #5
0
 public void TransitionToState(EnemyBaseState state)
 {
     currentState = state;
     currentState.EnterState(this);
 }
예제 #6
0
파일: Enemy.cs 프로젝트: LsaNa1s/MyGame
 public void TransitionToState(EnemyBaseState state) //状态机切换
 {
     currentState = state;                           //进入状态方法
     currentState.EnterState(this);
 }