Ejemplo n.º 1
0
 private void SyncCurrentStateIndex(int oldStateIndex, int newStateIndex)
 {
     currentStateIndex = newStateIndex;
     if (currentStateIndex >= 0)
     {
         currentState = states[currentStateIndex];
     }
 }
Ejemplo n.º 2
0
    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);
    }