public void QueueBuildCommand() { BuildPlotLocation location = selectedBuildPlotManager.GetSelectedLocation(); GameBehaviourCommand command = BuildingCommandFactory.CreateConstructBuildingCommand(location, buildingType, PlayerType.PLAYER); QueueUpCommand(command); }
public void QueueDemolishCommand() { // Get plot that contains building Dictionary <BuildPlotLocation, BuildPlot> buildPlots = GetBuildPlotController().buildPlotMap.buildPlots; foreach (BuildPlotLocation plotLocation in buildPlots.Keys) { if (GetBuildPlotController().buildPlotMap.GetBuilding(plotLocation) == buildingType) { GameBehaviourCommand command = BuildingCommandFactory.CreateDemolishCommand(plotLocation, PlayerType.PLAYER); QueueUpCommand(command); } } }
public AI_GameBehaviourCommand GetBuildingCommand(BuildingModel model) { BuildPlotController buildPlotController = GetBuildPlotController(); BuildingType buildingType = model.type; foreach (BuildPlotLocation location in Enum.GetValues(typeof(BuildPlotLocation)).Cast <BuildPlotLocation>()) { BuildingType buildingOnPlot = buildPlotController.buildPlotMap.GetBuilding(location); if (buildingOnPlot == BuildingType.NONE) { GameBehaviourCommand command = BuildingCommandFactory.CreateConstructBuildingCommand(location, buildingType, PlayerType.AI); AI_GameBehaviourCommand aiCommand = new AI_GameBehaviourCommand(command, model.buildCost, model.constructionTime); return(aiCommand); } } // No building commmand return(null); }