EventManager.addEventListener C# (CSharp) Method

addEventListener() public method

public addEventListener ( string eventType, GameObject listener, string function ) : bool
eventType string
listener GameObject
function string
return bool
    public bool addEventListener(string eventType, GameObject listener, string function)
    {
        if (listener == null || eventType == null) {
            if (allowWarningOutputs) {
                Debug.LogWarning("Event Manager: AddListener failed due to no listener or event name specified.");
            }
            return false;
        }
        recordEvent(eventType);
        return recordListener(eventType, listener, function);
    }

Usage Example

Example #1
0
    public TestStateMachine()
    {
        this._state = States.Idle;

        EventManager.addEventListener("Attack", transitionToAttack);
        EventManager.addEventListener("Move", transitionToMove);
    }
All Usage Examples Of EventManager::addEventListener