public void _ChangeBuildingState(Building.BuildingState state) { foreach (MapObject obj in objects) { obj._ChangeState(state); } }
protected override void handleBuilding(Building b) { Building.BuildingState bstate = b.State; b.DoAI(); if (b.BuildStatus != null) { switch (bstate) { case Building.BuildingState.constructing: if (b.State == Building.BuildingState.normal) { if (UpdateStripItem != null) { UpdateStripItem(b.ObjectID.PlayerID, b.BuildStatus.ObjectId, b.BuildStatus.Typeid, -1); } OnBuildingCompleted(b, b.BuildStatus.ObjectId); b.BuildStatus = null; } else { if (UpdateStripItem != null) { UpdateStripItem(b.ObjectID.PlayerID, b.BuildStatus.ObjectId, b.BuildStatus.Typeid, b.BuildStatus.Percent); } } break; case Building.BuildingState.creating: if (b.State == Building.BuildingState.normal) { if (UpdateStripItem != null) { UpdateStripItem(b.ObjectID.PlayerID, b.BuildStatus.ObjectId, b.BuildStatus.Typeid, -1); } Position pos = FindFreeLocation(b.Position, this.Map); CreateUnit(b.ObjectID.PlayerID, b.BuildStatus.Typeid, pos); b.BuildStatus = null; } else { if (UpdateStripItem != null) { UpdateStripItem(b.ObjectID.PlayerID, b.BuildStatus.ObjectId, b.BuildStatus.Typeid, b.BuildStatus.Percent); } } break; } } }
public void _ChangeState(Building.BuildingState state) { this.state = (int)state; building._ChangeState(state); }