示例#1
0
 /// <summary> Appel la fonction Exit() du vieux state et le Enter() du nouveau </summary>
 /// <param name="newState"> Nouveau state </param>
 public void ChangeState(IStates newState)
 {
     currentState.Exit();
     previousState = currentState;
     currentState  = newState;
     currentState.Enter();
 }
示例#2
0
 // Use this for initialization
 void Start()
 {
     _actor       = GetComponent <IActor> ();
     StartNode    = grid.PostoNode(_actor.Position);
     currentState = calcState;
     currentState.Enter();
 }
示例#3
0
 public Rescuer(OrientedActor actor, OrientedActor teammate)
 {
     self         = actor;
     teamMate     = teammate;
     rescueState  = new RescueState(self, teamMate);
     currentState = rescueState;
     currentState.Enter();
 }
示例#4
0
    public void ChangeState(IStates newState)
    {
        if (currentState != null)
        {
            currentState.Exit();
        }

        currentState = newState;
        currentState.Enter(this);
    }
示例#5
0
 public void ToSad()
 {
     currentState.ResetPathColor();
     currentState = new SadState(self);
     currentState.Enter();
 }
示例#6
0
 public void ToHappy()
 {
     currentState.ResetPathColor();
     currentState = new HappyState(self);
     currentState.Enter();
 }
示例#7
0
 /// <summary> Retourne au state precedent </summary>
 public void SwitchToPreviousState()
 {
     currentState.Exit();
     currentState = previousState;
     currentState.Enter();
 }
示例#8
0
 void Awake()
 {
     mCurrentState = new StandingState();
     mCurrentState.Enter(this);
 }