Exemplo n.º 1
0
 private void OnClickBuildingButton(Button clickedButton, GameBuildingConfig config)
 {
     Game.UseBuilding(config);
     foreach (Button button in BuildingButtons)
     {
         button.interactable = button != clickedButton;
     }
 }
Exemplo n.º 2
0
        private void InstantiateButton(GameBuildingConfig building)
        {
            GameObject go = Instantiate(BuildingButtonPrefab);

            go.transform.SetParent(BuildingButtonContainer, false);

            var buildingButton = go.GetComponentInChildren <BuildingButton>();

            buildingButton.ShowLogo(building.Type);
            var text = go.GetComponentInChildren <Text>();

            text.text = $"{building.Price}K$";
            var button = go.GetComponentInChildren <Button>();

            button.onClick.AddListener(() => OnClickBuildingButton(button, building));
            BuildingButtons.Add(button);
        }