HasPrerequisites() public method

public HasPrerequisites ( IEnumerable prerequisites ) : bool
prerequisites IEnumerable
return bool
Ejemplo n.º 1
0
        public int GetLevel()
        {
            var availables = Info.Prerequisites.Where(p => techTree.HasPrerequisites(p.Value));
            var level      = availables.Any() ? availables.Max(p => p.Key) : 0;

            return(developerMode.AllTech ? Info.Prerequisites.Max(p => p.Key) : level);
        }
Ejemplo n.º 2
0
        int IProductionCostModifierInfo.GetProductionCostModifier(TechTree techTree, string queue)
        {
            if ((!Queue.Any() || Queue.Contains(queue)) && (!Prerequisites.Any() || techTree.HasPrerequisites(Prerequisites)))
            {
                return(Multiplier);
            }

            return(100);
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
0
        void Update()
        {
            enabled = !IsTraitDisabled;
            if (IsTraitDisabled)
            {
                return;
            }

            if (Info.Factions.Any())
            {
                enabled = Info.Factions.Contains(faction);
            }

            if (Info.RequiresPrerequisites.Any() && enabled)
            {
                enabled = techTree.HasPrerequisites(Info.RequiresPrerequisites);
            }
        }