/* Route building UI button click to the building state (TODO: replace with event?) */ public void UIBuildingClicked(UIBuilding element) { var buildingState = mStates[EGameState.Building]; if (mGameState == EGameState.Building) { ((StateBuilding)buildingState).UIBuildingClicked(element); } }
void Awake() { Bounds boxBounds = GetComponentInChildren <BoxCollider>().bounds; xWidth = Mathf.RoundToInt(boxBounds.max.x / 2); zDepth = Mathf.RoundToInt(boxBounds.max.z / 2); CenterNode = Grid.Instance.GetNodeFromPoint(buildingPivot.position); buildingPivot.position = Grid.Instance.GetPointFromNode(centerNode.x, centerNode.z); UIBuilding uiBuil = Instantiate(uiBuilding, uiBuilding.transform.position, Quaternion.identity) as UIBuilding; uiBuil.transform.SetParent(GameObject.Find("Menu").transform, true); uiBuilding = uiBuil; }