Ejemplo n.º 1
0
        /// <summary>
        /// Determins if all tech and stat requirements are met for this building
        /// </summary>
        /// <param name="statManager"></param>
        /// <param name="techManager"></param>
        /// <returns>True if requirements met, false otherwise</returns>
        public bool RequirementsMet(StatManager statManager, TechManager techManager)
        {
            foreach (var requirement in statRequirements)
            {
                var statname = requirement.name;
                var stat     = statManager.Stat(statname);
                if (!requirement.IsSatisfied((float)stat.Value))
                {
                    return(false);
                }
            }

            foreach (var tech in techRequirements)
            {
                if (!techManager.TechResearched(tech))
                {
                    return(false);
                }
            }

            return(true);
        }