public void InformationSetUp(SpawnerBuilding building) { selectedBuilding = building; if (selectedBuilding == null || !selectedBuilding.building.GetBuildingHealthSystem().Built) { DisableButtons(); return; } AssignBuildingSpawnButtons(selectedBuilding); }
private void AssignBuildingSpawnButtons(SpawnerBuilding building) { DisableButtons(); canvas.SetActive(true); for (var i = 0; i < building.unitsToSpawn.Length; i++) { spawnButtons[i].onClick.RemoveAllListeners(); var spawnObject = building.unitsToSpawn[i]; spawnButtons[i].onClick.RemoveAllListeners(); spawnButtons[i].onClick.AddListener(() => { building.AddToQueue(spawnObject); }); spawnButtons[i].image.sprite = spawnObject.GetComponent <IBasicData>().Image; spawnButtons[i].image.enabled = true; spawnButtons[i].enabled = true; Tooltip _Tooltip = spawnButtons[i].GetComponent <Tooltip>(); _Tooltip.SetData(spawnObject.GetComponent <ISpendable>()); } }