コード例 #1
0
        public ResearchUpgradeStep(UpgradeType target, IEnumerable <Prerequisite> extraPrerequisites)
        {
            Research     = UpgradeTypes.All[target];
            ResearchedBy = Research.WhatUpgrades.Type;

            var defaultPrerequisites = new Prerequisite[]
            {
                new BuildingExistsPrerequisite(ResearchedBy),
                new ResourcePrerequisite(Research.MineralPrice(0), Research.GasPrice(0)),
            };

            Prerequisites = defaultPrerequisites.Concat(extraPrerequisites).ToList();
            Target        = target;
        }
コード例 #2
0
        public ResearchTechStep(TechType target, IEnumerable <Prerequisite> extraPrerequisites)
        {
            Research     = TechTypes.All[target];
            ResearchedBy = Research.WhatResearches.Type;

            var defaultPrerequisites = new Prerequisite[]
            {
                new BuildingExistsPrerequisite(ResearchedBy),
                new ResourcePrerequisite(Research.Price.Minerals, Research.Price.Gas)
            };

            Prerequisites = defaultPrerequisites.Concat(extraPrerequisites).ToList();
            Target        = target;
        }
コード例 #3
0
        public MorphUnitStep(UnitType target, IEnumerable <Prerequisite> extraPrerequisities)
        {
            var unitType             = UnitTypes.All[target];
            var defaultPrerequisites = new Prerequisite[]
            {
                new AvailableSupplyPrerequisite(unitType.Price.Supply / 2),
                new ResourcePrerequisite(unitType.Price.Minerals, unitType.Price.Gas)
            };

            var unitPrerequisites     = unitType.RequiredUnits.Keys.Where(u => !u.IsBuilding).Select(x => new UnitExistsPrerequisite(x.Type));
            var buildingPrerequisites = unitType.RequiredUnits.Keys.Where(u => u.IsBuilding).Select(x => new BuildingExistsPrerequisite(x.Type));

            Prerequisites = defaultPrerequisites.Concat(unitPrerequisites).Concat(buildingPrerequisites).Concat(extraPrerequisities).ToList();
            Target        = target;
        }