private void AddAbility(AbilityGUI ability) { abilitys.Add(ability); var childCount = transform.childCount; if (childCount == 0) { return; } var containerSize = rectTransform.rect.size; var cellWidth = ((containerSize.x - space * (childCount - 1)) / childCount); var cellSize = Mathf.Min(cellWidth, containerSize.y); var i = 0; foreach (Transform child in transform) { var childRect = child.GetComponent <RectTransform>(); childRect.sizeDelta = new Vector2(cellSize, cellSize); childRect.anchoredPosition = new Vector2((cellSize + scaledSpace) * i, 0); i++; } }
public AbilitySlot(AbilityGUI gui, string hotkeyName) { abilityGUI = gui; this.hotkeyName = hotkeyName; Unlocked = false; abilityGUI.gameObject.SetActive(false); }