private void CommandState_OnSelected(StateHotspot sender, ControlState newState) { // Stopping the current state currentState.Stop(); // Switching to the new state currentState = newState; // Switching the selected state hotspot to the new state hotspot selectedStateHotspot.selected = false; selectedStateHotspot = sender; selectedStateHotspot.selected = true; // Starting the new state currentState.Start(); }