コード例 #1
0
        /// <summary>
        /// Determines if this unit is of the specified type, or possibly an upgraded form of the same thing.
        /// </summary>
        public bool CountsAs(BuildingOrUnitType type)
        {
            if (this.Type == type)
            {
                return(true);
            }

            // Handle buildings that get upgraded to 'different types' but still count
            // TODO: Handle this better, elsewhere
            if (type == TerranBuildingType.CommandCenter &&
                (this.Type == TerranBuildingType.PlanetaryFortress ||
                 this.Type == TerranBuildingType.OrbitalCommand))
            {
                return(true);
            }

            if (type == ZergBuildingType.Hatchery &&
                (this.Type == ZergBuildingType.Lair ||
                 this.Type == ZergBuildingType.Hive))
            {
                return(true);
            }

            if (type == ZergBuildingType.Lair &&
                this.Type == ZergBuildingType.Hive)
            {
                return(true);
            }

            if (type == ZergBuildingType.HydraliskDen &&
                this.Type == ZergBuildingType.LurkerDen)
            {
                return(true);
            }

            if (type == ZergBuildingType.Spire &&
                this.Type == ZergBuildingType.GreaterSpire)
            {
                return(true);
            }

            if (type == TerranBuildingType.TechLab &&
                (this.Type == TerranBuildingType.BarracksTechLab ||
                 this.Type == TerranBuildingType.FactoryTechLab ||
                 this.Type == TerranBuildingType.StarportTechLab))
            {
                return(true);
            }

            if (type == TerranBuildingType.Reactor &&
                (this.Type == TerranBuildingType.BarracksReactor ||
                 this.Type == TerranBuildingType.FactoryReactor ||
                 this.Type == TerranBuildingType.StarportReactor))
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
 public UnitCost(uint minerals, uint vespene, float supply, BuildingOrUnitType builder, BuildingOrUnitType prerequisite)
 {
     this.Minerals     = minerals;
     this.Vespene      = vespene;
     this.Supply       = supply;
     this.Builder      = builder;
     this.Prerequisite = prerequisite;
 }
コード例 #3
0
        private bool IsUnitOfType(Unit unit, BuildingOrUnitType type)
        {
            if (unit.Type == type)
            {
                return(true);
            }

            // Handle buildings that get upgraded to 'different types' but still count
            // TODO: Handle this better, elsewhere
            if (type == TerranBuildingType.CommandCenter &&
                (unit.Type == TerranBuildingType.PlanetaryFortress ||
                 unit.Type == TerranBuildingType.OrbitalCommand))
            {
                return(true);
            }

            if (type == ZergBuildingType.Hatchery &&
                (unit.Type == ZergBuildingType.Lair ||
                 unit.Type == ZergBuildingType.Hive))
            {
                return(true);
            }

            if (type == ZergBuildingType.Lair &&
                unit.Type == ZergBuildingType.Hive)
            {
                return(true);
            }

            if (type == ZergBuildingType.HydraliskDen &&
                unit.Type == ZergBuildingType.LurkerDen)
            {
                return(true);
            }

            if (type == ZergBuildingType.Spire &&
                unit.Type == ZergBuildingType.GreaterSpire)
            {
                return(true);
            }

            return(false);
        }
コード例 #4
0
 public bool IsBuilding(BuildingOrUnitType buildingOrUnitType)
 {
     return(translator.IsBuilding(this.Raw, buildingOrUnitType));
 }