// Use this for initialization public void SpawnButtons(MageAssignableBuilding building, UIManager uiManager) { _uiManager = uiManager; AttachedBuilding = building; _buttonList = new QkButton[building.options.Length]; for (var i = 0; i < _buttonList.Length; i++) { var newButton = Instantiate(ButtonPrefab); newButton.transform.SetParent(transform, false); var theta = (2 * Mathf.PI / building.options.Length) * i; newButton.Init(theta, building.options[i]); _buttonList[i] = newButton; //First button is always close button! if (i == 0) { newButton.GetButton().onClick.AddListener( delegate { CloseMenu(); } ); } //Third button always have cooldown if (i == 2) { newButton.GetComponent <CoolDown>().enabled = true; if (!AttachedBuilding.InsideMage.CanCast()) { newButton.GetComponent <CoolDown>().Cooldown(ElementController.Instance.GetElementSkillCooldown(AttachedBuilding.InsideMage.Data.GetElement()), AttachedBuilding.InsideMage.CooldownStart); } } } AttachedBuilding.DisplayRangeObject(); AttachedBuilding.StartHighlighting(); }