private void SyncCurrentStateIndex(int oldStateIndex, int newStateIndex) { currentStateIndex = newStateIndex; if (currentStateIndex >= 0) { currentState = states[currentStateIndex]; } }
public void ServerChangeState(StatefulState newState) { var newStateIndex = states.FindIndex(se => se == newState); if (newStateIndex == -1) { Logger.LogErrorFormat("New state doesn't exist in States defined for {0}. State will not be changed.", Category.Interaction, this); return; } SyncCurrentStateIndex(currentStateIndex, newStateIndex); }