public void OnSelectTurret(EmplacementTurretPurchaseButton fromButton) { SetTurretPurchased(fromButton.turretPrefab.Name); emplacement.ChangeTurret(fromButton.obj); currentTurretButton = fromButton; RebuildButtons(); }
private void CreateTurretPurchaseButtons() { foreach (GameObject obj in purchaseableTurrets) { GameObject newButton = Instantiate(turretButtonPrefab, turretButtonParent); EmplacementTurretPurchaseButton butt = newButton.GetComponent <EmplacementTurretPurchaseButton> (); butt.turretPrefab = obj.GetComponent <EmplacementTurret> (); FeedButtonData(butt, obj); butt.cost = obj.GetComponent <EmplacementTurret> ().cost; if (butt.obj == emplacement.turretPrefab) { currentTurretButton = butt; SetTurretPurchased(butt.turretPrefab.Name); } } }