public void Build(BuildPlotLocation location, BuildingType buildingType, BuildingModel buildingModel) { buildPlotMap.Build(location, buildingType, buildingModel); OutputPlotStatus(); UpdateBuildPlotView(location); UpdateBuildingInfoView(buildingType); }
public void QueueBuildCommand() { BuildPlotLocation location = selectedBuildPlotManager.GetSelectedLocation(); GameBehaviourCommand command = BuildingCommandFactory.CreateConstructBuildingCommand(location, buildingType, PlayerType.PLAYER); QueueUpCommand(command); }
public DemolishBuildingCommand(BuildPlotLocation buildPlotLocation, PlayerType playerType) { this.playerType = playerType; this.buildPlotLocation = buildPlotLocation; Debug.Log("demolish command created"); }
public ConstructBuildingCommand(BuildPlotLocation buildPlotLocation, BuildingType buildingType, PlayerType playerType) { this.playerType = playerType; this.buildPlotLocation = buildPlotLocation; this.buildingType = buildingType; buildingModel = null; Debug.Log("build command created"); }
public BuildPlot(BuildPlotLocation location, PlayerType playerType) { this.playerType = playerType; buildingType = BuildingType.NONE; this.location = location; isUnderConstruction = false; constructedTicks = 0; constructionTime = 0; }
public void Demolish(BuildPlotLocation location) { // get type for view update BuildingType buildingType = buildPlotMap.GetBuilding(location); // demolish buildPlotMap.Demolish(location); // update views OutputPlotStatus(); UpdateBuildPlotView(location); UpdateBuildingInfoView(buildingType); }
public void UpdateBuildPlotView(BuildPlotLocation location) { if (playerType == PlayerType.AI) { return; } bool isUnderConstruction = buildPlotMap.IsUnderConstruction(location); buildPlotViews[location].UpdateUnderConstruction(isUnderConstruction); BuildingType building = buildPlotMap.GetBuilding(location); buildPlotViews[location].UpdateCurrentBuilding(building); }
public void ShowSelectedBuildPlot() { BuildPlotLocation selectedItem = GetSelectedLocation(); foreach (KeyValuePair <BuildPlotLocation, BuildPlotView> entry in buildPlotViews) { if (selectedItem == entry.Key) { entry.Value.gameObject.SetActive(true); } else { entry.Value.gameObject.SetActive(false); } } }
public void InitialiseBuildPlotViewObjects() { buildPlotViews = new Dictionary <BuildPlotLocation, BuildPlotView>(); BuildPlotLocation location = ConvertStringToBuildPlotLocation("North East"); buildPlotViews[ConvertStringToBuildPlotLocation("North East")] = GameObject.Find("BuildPlotPanel - NorthEast").GetComponent <BuildPlotView>(); location = ConvertStringToBuildPlotLocation("North West"); buildPlotViews[location] = GameObject.Find("BuildPlotPanel - NorthWest").GetComponent <BuildPlotView>(); location = ConvertStringToBuildPlotLocation("South"); buildPlotViews[location] = GameObject.Find("BuildPlotPanel - South").GetComponent <BuildPlotView>(); location = ConvertStringToBuildPlotLocation("West"); buildPlotViews[location] = GameObject.Find("BuildPlotPanel - West").GetComponent <BuildPlotView>(); }
public BuildingType GetBuilding(BuildPlotLocation location) { return(buildPlots[location].buildingType); }
// Safety functions public bool IsBuildable(BuildPlotLocation location) { return(buildPlots[location].IsEmpty() && !buildPlots[location].isUnderConstruction); }
public bool IsDemolishable(BuildPlotLocation location) { return(!(buildPlots[location].IsEmpty() || buildPlots[location].isUnderConstruction)); }
public static GameBehaviourCommand CreateConstructBuildingCommand(BuildPlotLocation plotLocation, BuildingType buildingType, PlayerType playerType) { return(new ConstructBuildingCommand(plotLocation, buildingType, playerType)); }
public static GameBehaviourCommand CreateDemolishCommand(BuildPlotLocation plotLocation, PlayerType playerType) { return(new DemolishBuildingCommand(plotLocation, playerType)); }
// Check if buildable before this! public void Build(BuildPlotLocation location, BuildingType buildingType, BuildingModel buildingModel) { buildPlots[location].Build(buildingType, buildingModel); }
public bool IsDemolishable(BuildPlotLocation location) { return(buildPlotMap.IsDemolishable(location)); }
// Check if Demolishable before this! public void Demolish(BuildPlotLocation location) { buildPlots[location].Demolish(); }
public bool IsUnderConstruction(BuildPlotLocation location) { return(buildPlots[location].isUnderConstruction); }