Example #1
0
        public void Unregister(Actor actor, GlobalUpgradable u, string[] prerequisites)
        {
            var key  = MakeKey(prerequisites);
            var list = upgradables[key];

            list.RemoveAll(x => x.First == actor && x.Second == u);
            if (!list.Any())
            {
                upgradables.Remove(key);
                techTree.Remove(key);
            }
        }
Example #2
0
        void ActorRemoved(Actor a)
        {
            if (a.Owner != self.Owner || !a.HasTrait <SupportPower>())
            {
                return;
            }

            foreach (var t in a.TraitsImplementing <SupportPower>())
            {
                var key = MakeKey(t);
                Powers[key].Instances.Remove(t);

                if (Powers[key].Instances.Count == 0 && !Powers[key].Disabled)
                {
                    Powers.Remove(key);
                    TechTree.Remove(key);
                    TechTree.Update();
                }
            }
        }