Beispiel #1
0
    public void TriggerEvent(GameEventsList.PlayerEvents EventType, PlayerEventParams playerEventParams)
    {
        EventIds eventIds = m_EventIdMapper.Find(x => x._eventType == EventType);

        if (eventIds != null)
        {
            InvokeRelevantListeners(eventIds._ids, GameEventHandlers.GetInvocationList(), playerEventParams);
        }
        else
        {
            //Debug.Log("Key Not Found!");
        }
    }
Beispiel #2
0
    public void UnsubscribeEvent(GameEventsList.PlayerEvents EventType, System.Action <PlayerEventParams> eventHandler)
    {
        if (eventHandler == null)
        {
            return;
        }

        GameEventHandlers -= eventHandler;

        EventIds eventIds = m_EventIdMapper.Find(x => x._eventType == EventType);

        if (eventIds != null)
        {
            eventIds._ids.Remove(eventHandler.GetHashCode());
        }
    }
Beispiel #3
0
    public void SubscribeEvent(GameEventsList.PlayerEvents EventType, System.Action <PlayerEventParams> eventHandler)
    {
        GameEventHandlers += eventHandler;
        EventIds eventIds = m_EventIdMapper.Find(x => x._eventType == EventType);

        if (eventIds == null)
        {
            eventIds            = new EventIds();
            eventIds._eventType = EventType;
            eventIds._ids.Add(eventHandler.GetHashCode());
            m_EventIdMapper.Add(eventIds);
        }
        else
        {
            eventIds._ids.Add(eventHandler.GetHashCode());
        }
    }