public void SwitchState(RobotState robotState) { currentState.OnStateExit(); currentState = robotState; currentState.robot = this; currentState.OnStateEnter(); }
public void SwitchState(RobotState state) { currentState?.OnStateExit(); currentState = state; currentState.robot = this; currentState.OnStateEnter(); txt.text = "State : " + currentState.GetType().ToString(); }