} //The component that does the raycast checks. #region Public public void SwitchToNewState(MotorStates newStateType) //This method tells the class to change to a state { if (currentStateType != newStateType) //Only change the state when we're not already there { currentStateType = newStateType; currentStateClass.StateExit(); //Tell the current state we're exiting, so it can perform clean ups. currentStateClass = stateClassLookup[newStateType]; currentStateClass.StateEntry(); //Tell the new state we're entering, so it can perform initializations. } }
public void SwitchToNewState(MotorStates newStateType) { if (currentStateType != newStateType) { currentStateType = newStateType; currentStateClass.StateExit(); currentStateClass = stateClassLookup[newStateType]; currentStateClass.StateEntry(); } }