Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        public void Register(Actor actor, GlobalUpgradable u, string[] prerequisites)
        {
            var key = MakeKey(prerequisites);

            if (!upgradables.ContainsKey(key))
            {
                upgradables.Add(key, new List <Pair <Actor, GlobalUpgradable> >());
                techTree.Add(key, prerequisites, 0, this);
            }

            upgradables[key].Add(Pair.New(actor, u));

            // Notify the current state
            u.PrerequisitesUpdated(actor, techTree.HasPrerequisites(prerequisites));
        }