void OnBuyBuildingEvent(BuyBuildingEvent e) { if (e.Building == this) { SetState(BuildingState.Owned); } }
void PlayerBuild(Player player, Grid grid) { if (player == null) { Debug.LogError("no player"); return; } BuyBuildingEvent _buyBuildEvent = new BuyBuildingEvent(); _buyBuildEvent.buyers = player; _buyBuildEvent.setGrid = grid; GUIController.Instance.ShowBuyUI(_buyBuildEvent); }
public void Build(BuyBuildingEvent buildEvent) { if (buildEvent == null) { return; } if (buildingPrfab != null) { GameObject _go = Instantiate(buildingPrfab) as GameObject; _go.transform.SetParent(bornParent); Building _building = _go.GetComponent <Building> (); buildEvent.item = _building; _building.InitBuilding(buildEvent.buyers, buildEvent.setGrid); } }
public void Apply() { if (getBuyEvent == null) { return; } if (selectBuyGroup != null) { foreach (var toggle in selectBuyGroup.GetComponentsInChildren <Toggle>()) { if (toggle.isOn) { if (getBuyEvent is BuyBuildingEvent) { BuildingItemUI _buildItemUI = toggle.GetComponent <BuildingItemUI> (); BuyBuildingEvent _buildEvent = getBuyEvent as BuyBuildingEvent; _buildItemUI.Build(_buildEvent); } JobDone(); } } } }
void OnBuyBuildingEvent(BuyBuildingEvent e) { wealth -= e.Building.Value; buildings.Add(e.Building); }