Esempio n. 1
0
        public static void Updater_Update()
        {
            foreach (Agent agent in GameController.gameController.agentList.ToList())
            {
                foreach (IDoUpdate obj in agent.GetHooks <IDoUpdate>())
                {
                    try { obj.Update(); }
                    catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj); }
                }

                InvItem specialAbility = agent.inventory.equippedSpecialAbility;
                if (specialAbility != null)
                {
                    foreach (IDoUpdate obj in specialAbility.GetHooks <IDoUpdate>())
                    {
                        try { obj.Update(); }
                        catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj, agent); }
                    }
                }

                foreach (InvItem item in agent.inventory.InvItemList.ToList())
                {
                    if (item != specialAbility)
                    {
                        foreach (IDoUpdate obj in item.GetHooks <IDoUpdate>())
                        {
                            try { obj.Update(); }
                            catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj, agent); }
                        }
                    }
                }

                foreach (StatusEffect effect in agent.statusEffects.StatusEffectList.ToList())
                {
                    foreach (IDoUpdate obj in effect.GetHooks <IDoUpdate>())
                    {
                        try { obj.Update(); }
                        catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj, agent); }
                    }
                }

                foreach (Trait trait in agent.statusEffects.TraitList.ToList())
                {
                    foreach (IDoUpdate obj in trait.GetHooks <IDoUpdate>())
                    {
                        try { obj.Update(); }
                        catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj, agent); }
                    }
                }
            }

            foreach (ObjectReal objectReal in GameController.gameController.objectRealListUpdate.ToList())
            {
                foreach (IDoUpdate obj in objectReal.GetHooks <IDoUpdate>())
                {
                    try { obj.Update(); }
                    catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj); }
                }

                if (objectReal.objectInvDatabase != null)
                {
                    foreach (InvItem item in objectReal.objectInvDatabase.InvItemList)
                    {
                        foreach (IDoUpdate obj in item.GetHooks <IDoUpdate>())
                        {
                            try { obj.Update(); }
                            catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj, objectReal); }
                        }
                    }
                }
            }

            foreach (Item item in GameController.gameController.itemList.ToList())
            {
                foreach (IDoUpdate obj in item.invItem.GetHooks <IDoUpdate>())
                {
                    try { obj.Update(); }
                    catch (Exception e) { RogueFramework.LogError(e, "IDoUpdate.Update", obj, item); }
                }
            }
        }