void SwitchState(States.State newState) { if (newState == null) { return; // don't switch to nothing.... } if (state != null) { state.OnEnd(); // tell previous states it is done } state = newState; //swap states state.OnStart(this); }
/// <summary> /// allows the state machine to switch between different states /// </summary> /// <param name="newState"></param> void SwitchState(States.State newState) { if (newState == null) { return; // do not switch } if (state != null) { state.OnEnd(); // when is previous state finished running } state = newState; // change the states state.OnStart(this); }
void SwitchState(States.State newState) { if (newState == null) { return; } if (state != null) { state.OnEnd(); } state = newState; state.OnStart(this); }
/// <summary> /// Makes the state swtich to a different state /// </summary> /// <param name="newState"></param> void SwitchState(States.State newState) { if (newState == null) { return; // don't switch } if (state != null) { state.OnEnd(); // when it is done tell other states } state = newState; state.OnStart(this); }
void SwitchState(States.State newState) { if (newState == null) { return; // Don't switch to nothing... } // Call the current state's onEnd function. if (state != null) { state.OnEnd(); } // Switch the state. state = newState; // Call the new state's onStart function. state.OnStart(this); }
/// <summary> /// This funtion switches between the boss's states /// </summary> /// <param name="newState"></param> void SwitchState(States.State newState) { if (newState == null) { return; // Can't switch to nothing } // Call the previous state's on end if (state != null) { state.OnEnd(); } // Switch to the new state state = newState; // Call the new state's on start function state.OnStart(this); }
void SwitchState(States.State newState) { // If there is nothing to switch to if (newState == null) { return; } if (state != null) { state.OnEnd(); // Call the current state's OnEnd } // Switch the state state = newState; // Call the new state's OnStart function state.OnStart(this); }
void SwitchState(States.State newState) { // If null is passed in, return nothing. if (newState == null) { return; } // If we are in a state, call it's onEnd. if (state != null) { state.OnEnd(); } // Switch the state state = newState; // Call the new state's start function. state.OnStart(this); }