} // Update del estado actual. public void Transition(T input) { FSMState <T> newState = _currentState.GetTransition(input); if (newState != null) { _currentState.Sleep(); _currentState = newState; _currentState.Awake(); } } // Añadir transicion de nuevo estado.
public void Transition(T input) { FSMState <T> newState = _currentState.GetTransition(input); if (newState == null) { return; } _currentState.Sleep(); _currentState = newState; _currentState.Awake(); }
//Funcion que se encargará de manejar las transiciones public void Transition(T input) { //Agarro el estado que deseo ejecutar FSMState <T> newState = _current.GetTransition(input); //En caso de que el estado exista en el diccionario, lo ejecuto y apago el actual if (newState != null) { _current.Sleep(); _current = newState; _current.Awake(); } }
public void SetInit(FSMState <T> init) { _currentState = init; _currentState.Awake(); }
FSMState <T> _currentState; // Estado actual. public void SetInitState(FSMState <T> initState) { _currentState = initState; _currentState.Awake(); } // Inicializar estado.
//Funcion donde declaro el initialState como _current y ejecuto su awake public void SetInitialState(FSMState <T> initialState) { _current = initialState; _current.Awake(); }