private void onRetryGame(GhostGen.GeneralEvent e)
    {
        view.RemoveListener("on_retry", onRetryGame);
        RemoveView();

        Singleton.instance.notificationDispatcher.DispatchEvent(GameplayEventType.GAME_RETRY);
    }
Example #2
0
 private void onLootPickedUp(GhostGen.GeneralEvent e)
 {
     LootConfig.LootItemDef itemDef = e.data as LootConfig.LootItemDef;
     if (itemDef != null)
     {
         AddItem(itemDef.type, itemDef.GetQuantitiy());
         _dispatcher.DispatchEvent(GameplayEventType.INVENTORY_UPDATED, false, itemDef.type);
     }
 }
        private bool _invokeDispatchEvent(GeneralEvent e)
        {
            bool result = false;

            List <Action <GhostGen.GeneralEvent> > callbackList = null;

            if (_eventDictionary.TryGetValue(e.type, out callbackList))
            {
                int length = callbackList.Count;
                for (int i = 0; i < length; ++i)
                {
                    if (callbackList[i] != null)
                    {
                        callbackList[i].Invoke(e);
                    }
                }

                result = true;
            }
            else if (canBubble(e.isBubbling))
            {
                e.isBubbling = false; // Don't double bubble
                Transform          parent         = _bubbler.parent;
                IEventDispatcher[] dispatcherList = parent.GetComponentsInParent <IEventDispatcher>();
                for (int i = 0; i < dispatcherList.Length; ++i)
                {
                    e.currentTarget = dispatcherList[i];
                    if (dispatcherList[i].DispatchEvent(e))
                    {
                        result = true;
                        break;
                    }
                }
            }
            return(result);
        }
 public bool DispatchEvent(GeneralEvent e)
 {
     return(_invokeDispatchEvent(e));
 }
 public bool DispatchEvent(GeneralEvent e)
 {
     return(dispatcher.DispatchEvent(e));
 }
Example #6
0
 private void OnEnemyDestroyed(GhostGen.GeneralEvent e)
 {
     _enemyList.Sort(EnemyUtil.CompareEnemiesByHealth);
 }
Example #7
0
    private void OnGameComplete(GhostGen.GeneralEvent e)
    {
        bool win = (bool)e.data;

        _currentFlowState.OnGameOver();
    }
Example #8
0
 private void onEnemyKilled(GhostGen.GeneralEvent e)
 {
     _currentFlowState.OnMonsterDestroyed();
 }