コード例 #1
0
ファイル: EventManager.cs プロジェクト: usernameHed/BackHome
    public static void StartListening(GameData.Event eventName, UnityAction <GameObject, int, int> listener)
    {
        if (!Instance)
        {
            return;
        }

        UnityEventGameObject2Int thisEvent = null;

        if (Instance.eventDictionaryGameObject2Int.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new UnityEventGameObject2Int();
            thisEvent.AddListener(listener);
            Instance.eventDictionaryGameObject2Int.Add(eventName, thisEvent);
        }
    }