public void SetBuildingType(SimpleBuildingType buildingType) { if (AvailableBuildingTypes.Contains(buildingType)) { currentBuildingIndex = AvailableBuildingTypes.IndexOf(buildingType); } else { return; } SetTerraformType((int)TerraFormType.BUILD); currentTerraform = TerraFormType.BUILD; playerDisplay.tmpBuildObject = (GameObject)GameObject.Instantiate(buildingType.prefab, transform.position, transform.rotation); playerDisplay.tmpBuildObject.GetComponent <SimpleBuildingBehaviour>().enabled = false; playerDisplay.tmpBuildObject.transform.SetParent(transform); playerDisplay.tmpBuildObject.transform.localScale = buildingType.scale; }
public void SetTerraformType(int newType) { direction = 0; gridOverlay.isVisible = false; currentTerraform = (TerraFormType)newType; playerDisplay.SetTerraformType(currentTerraform); switch (currentTerraform) { case TerraFormType.BULLDOZE: gridOverlay.overlayType = GridOverlay.OverlayType.SQUARE; break; case TerraFormType.BULLDOZE_AREA: gridOverlay.overlayType = GridOverlay.OverlayType.SQUARE; break; case TerraFormType.RAISE_TERRAIN: gridOverlay.overlayType = GridOverlay.OverlayType.CROSS; break; case TerraFormType.LOWER_TERRAIN: gridOverlay.overlayType = GridOverlay.OverlayType.CROSS; break; case TerraFormType.LEVEL_TERRAIN: gridOverlay.overlayType = GridOverlay.OverlayType.SQUARE; break; case TerraFormType.BUILD: gridOverlay.overlayType = GridOverlay.OverlayType.SQUARE; break; default: break; } }
/// <summary> /// Returns true if the current terraform operation is performed on a tile. This has an effect of where player should be positioned /// if it is a tile then the arrow should mark the center of it otherwise a grid point (tile corner) /// </summary> protected bool IsTileOperation(TerraFormType terraform) { return(terraform == TerraFormType.BUILD || terraform == TerraFormType.BULLDOZE); }