private void ProceedConstruction(Point pos) { var result = from target in this.listOfBuildings where (target.Position == pos && target.state != BuildingState.Ready) select target; if (result.Count() > 0) { BuildingBase b = result.ElementAt(0); if (!this.mayorObject.GetFreeUnits(b.GetWorkersNeeded(), PrivilegesCosts.PrivilegedWorker)) { this.mayorObject.ShowMessageBox(); this.isAboutToProceed = false; return; } this.mayorObject.SendBuilders(b.GetWorkersNeeded()); b.ConstructionPaused = false; } else { MessageBox msgBox = null; MessageBox.Show(this.Game, "Building is ready", "Mayor said: ", MessageBoxButton.OK, this.mayorObject.FaceTex, out msgBox); } this.isAboutToProceed = false; }
private void PauseConstruction(Point pos) { var result = from target in this.listOfBuildings where (target.Position == pos && target.state != BuildingState.Ready) select target; if (result.Count() > 0) { BuildingBase b = result.ElementAt(0); b.ConstructionPaused = true; this.mayorObject.ReleaseBuilders(b.GetWorkersNeeded()); } else { MessageBox msgBox = null; MessageBox.Show(this.Game, "The construction process cannot be\n interrupted", "Mayor said: ", MessageBoxButton.OK, this.mayorObject.FaceTex, out msgBox); } this.isAboutToPauseConstruction = false; }