protected override void Update() { if (this.mWaitingBuilding != null) { this.mWaitingBuilding.Build(); this.mNextBuilding = ""; this.NbBuildingsAllowedToAdd--; this.mWaitingBuilding = null; } }
private void ChooseBuilding() { if (this.mNextBuilding == "") { if (!this.Buildings.Exists(b => b.Selection == "HQ")) { this.mNextBuilding = "HQ"; } else if (this.mRTSMgr.PlayerRTS.CrystalSpeed > 1.3 * this.CrystalSpeed || this.CrystalSpeed == 5) { this.mNextBuilding = "CD"; } else if (this.mRTSMgr.PlayerRTS.Capacity > 1.3 * this.Capacity || this.Capacity == 0) { this.mNextBuilding = "G"; } else if (this.mRTSMgr.PlayerRTS.NbFactory > 1.3 * this.NbFactory || this.NbFactory == 0) { this.mNextBuilding = "RF"; } else { mNextBuilding = new string[] { "CD", "G", "RF" }[this.mRandom.Next(0, 3)]; } } Island island = this.mWorld.getIsland(); switch (this.mNextBuilding) { case "HQ": this.mWaitingBuilding = new HeadQuarter(this.mStateMgr, island, this, this.GetBuildPos(HeadQuarter.sizeX, HeadQuarter.sizeZ)); break; case "CD": this.mWaitingBuilding = new CrystalDrill(this.mStateMgr, island, this, this.GetBuildPos(CrystalDrill.sizeX, CrystalDrill.sizeZ)); break; case "RF": this.mWaitingBuilding = new RobotFactory(this.mStateMgr, island, this, this.GetBuildPos(RobotFactory.sizeX, RobotFactory.sizeZ)); break; case "G": this.mWaitingBuilding = new Generator(this.mStateMgr, island, this, this.GetBuildPos(Generator.sizeX, Generator.sizeZ)); break; } }
public override void AddBuilding(Building b) { base.AddBuilding(b); this.mRTSMgr.AIRTS.NbBuildingsAllowedToAdd++; }