/// <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(); }
// Use this for initialization void Start() { _actor = GetComponent <IActor> (); StartNode = grid.PostoNode(_actor.Position); currentState = calcState; currentState.Enter(); }
public Rescuer(OrientedActor actor, OrientedActor teammate) { self = actor; teamMate = teammate; rescueState = new RescueState(self, teamMate); currentState = rescueState; currentState.Enter(); }
public void ChangeState(IStates newState) { if (currentState != null) { currentState.Exit(); } currentState = newState; currentState.Enter(this); }
public void ToSad() { currentState.ResetPathColor(); currentState = new SadState(self); currentState.Enter(); }
public void ToHappy() { currentState.ResetPathColor(); currentState = new HappyState(self); currentState.Enter(); }
/// <summary> Retourne au state precedent </summary> public void SwitchToPreviousState() { currentState.Exit(); currentState = previousState; currentState.Enter(); }
void Awake() { mCurrentState = new StandingState(); mCurrentState.Enter(this); }