protected override void Awake() { base.Awake(); this.units = new List <UnitBase>(); this.partyButtons = new PartyButton[PARTY_SIZE]; for (int i = 0; i < PARTY_SIZE; i++) { GameObject btn = GameObject.Instantiate(this.buttonPrefab, this.transform); RectTransform rt = btn.GetComponent <RectTransform>(); rt.anchoredPosition = new Vector3(-((rt.sizeDelta.y * i) + 36), 36, 0); btn.name = "PartyButton[" + i + "]"; PartyButton pb = btn.GetComponent <PartyButton>(); pb.setIndex(i); this.partyButtons[i] = pb; } }
public override void init(Player player) { base.init(player); this.unitsInParty = new List <UnitBase>(); this.partyButtons = new PartyButton[this.partySize]; // Create the buttons along the bottom of the screen. for (int i = 0; i < this.partyButtons.Length; i++) { GameObject btn = GameObject.Instantiate(this.buttonPrefab, this.transform); RectTransform rt = btn.GetComponent <RectTransform>(); rt.anchoredPosition = new Vector3(-(((rt.sizeDelta.y + buttonSpacing) * i) + 40), 40); btn.name = "PartyButton[" + i + "]"; PartyButton pb = btn.GetComponent <PartyButton>(); pb.setIndex(i); this.partyButtons[i] = pb; } }