Exemple #1
0
 public void SwitchState(RobotState state)
 {
     currentState?.OnStateExit();
     currentState       = state;
     currentState.robot = this;
     currentState.OnStateEnter();
     txt.text = "State : " + currentState.GetType().ToString();
 }
Exemple #2
0
    public void SetState(RobotState state)
    {
        if (CurrentState != null)
        {
            CurrentState.OnStateExit();
        }

        CurrentState    = state;
        gameObject.name = "Robot - " + state.GetType().Name;

        if (CurrentState != null)
        {
            CurrentState.OnStateEnter();
        }
    }