public static void RemoveEventReceiver(BuilderStateType builderState)
    {
        if(sharedInstance == null) {
            Debug.LogError("BuilderSetupHandler not properly setup!");
            return;
        }

        if(sharedInstance.stateTable == null) {
            Debug.LogError("State table not properly initialized!");
            return;
        }

        EventBroadcaster.Instance.RemoveObserver(sharedInstance.stateTable[builderState]);
    }
    /// <summary>
    /// Convenience function that attaches an event receiver via event broadcaster system by specifying
    /// the corresponding build state. Does not accept parameters.
    /// </summary>
    /// <param name="builderState">Builder state.</param>
    /// <param name="action">Action.</param>
    public static void RegisterEventReceiver(BuilderStateType builderState, System.Action action)
    {
        if(sharedInstance == null) {
            Debug.LogError("BuilderSetupHandler not properly setup!");
            return;
        }

        if(sharedInstance.stateTable == null) {
            Debug.LogError("State table not properly initialized!");
            return;
        }

        EventBroadcaster.Instance.AddObserver(sharedInstance.stateTable[builderState], action);
    }
示例#3
0
    /// <summary>
    /// Convenience function that attaches an event receiver via event broadcaster system by specifying
    /// the corresponding build state. Does not accept parameters.
    /// </summary>
    /// <param name="builderState">Builder state.</param>
    /// <param name="action">Action.</param>
    public static void RegisterEventReceiver(BuilderStateType builderState, System.Action action)
    {
        if (sharedInstance == null)
        {
            Debug.LogError("BuilderSetupHandler not properly setup!");
            return;
        }

        if (sharedInstance.stateTable == null)
        {
            Debug.LogError("State table not properly initialized!");
            return;
        }

        EventBroadcaster.Instance.AddObserver(sharedInstance.stateTable[builderState], action);
    }
示例#4
0
    public static void RemoveEventReceiver(BuilderStateType builderState)
    {
        if (sharedInstance == null)
        {
            Debug.LogError("BuilderSetupHandler not properly setup!");
            return;
        }

        if (sharedInstance.stateTable == null)
        {
            Debug.LogError("State table not properly initialized!");
            return;
        }

        EventBroadcaster.Instance.RemoveObserver(sharedInstance.stateTable[builderState]);
    }
示例#5
0
    public void SetState(BuilderStateType stateType)
    {
        this.currentState = stateType;

        EventBroadcaster.Instance.PostEvent(this.stateTable[this.currentState]);
    }
示例#6
0
 void Awake()
 {
     sharedInstance    = this;
     this.currentState = BuilderStateType.NONE;
     this.InitializeStateTable();
 }
 void Awake()
 {
     sharedInstance = this;
     this.currentState = BuilderStateType.NONE;
     this.InitializeStateTable();
 }
    public void SetState(BuilderStateType stateType)
    {
        this.currentState = stateType;

        EventBroadcaster.Instance.PostEvent(this.stateTable[this.currentState]);
    }