Ejemplo n.º 1
0
 /// <inheritdoc/>
 public void RegisterState(IIntegrationState state)
 {
     RegisteredStates.Add(state);
     if (state is ITruncatable truncatable)
     {
         TruncatableStates.Add(truncatable);
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Registers a State. After a state is registered it can be used in the state machine
    /// </summary>
    /// <param name="s">the state which should be registered</param>
    /// <returns>the registered state</returns>
    public State RegisterState(string name)
    {
        if (!IsStateRegistered(name))
        {
            State s = new State(name);
            RegisteredStates.Add(name, s);
            StateLeaveListeners.Add(s, new List <StateChange>());
            StateUpdateListeners.Add(s, new List <StateUpdate>());
            StateEnterListeners.Add(s, new List <StateChange>());
        }
        else
        {
            Debug.Log("state already registered");
        }

        return(GetState(name));
    }