コード例 #1
0
 public static void Invoke(GameEventData gameEvent, GameEventInfo info)
 {
     if (_gameEvents.ContainsKey(gameEvent))
     {
         _gameEvents[gameEvent].Invoke(info);
     }
 }
コード例 #2
0
        public void Trigger(bool useDelay = true)
        {
            GameEventInfo gameEventInfo = new GameEventInfo();

            foreach (BoolIDPair boolIDPair in bools)
            {
                gameEventInfo.PutBool(boolIDPair.id, boolIDPair.value);
            }

            foreach (IntIDPair intIDPair in ints)
            {
                gameEventInfo.PutInt(intIDPair.id, intIDPair.value);
            }

            foreach (FloatIDPair floatIDPair in floats)
            {
                gameEventInfo.PutFloat(floatIDPair.id, floatIDPair.value);
            }

            foreach (StringIDPair stringIDPair in strings)
            {
                gameEventInfo.PutString(stringIDPair.id, stringIDPair.value);
            }

            foreach (ObjectIDPair objectIDPair in objects)
            {
                gameEventInfo.PutObject(objectIDPair.id, objectIDPair.value);
            }

            if (delay >= 0.001f && useDelay)
            {
                GameEventManager.ExecuteTriggerList(new List <GameEventTrigger>()
                {
                    this
                });
            }
            else
            {
                GameEventManager.Invoke(gameEventData, gameEventInfo);
            }
        }