// Use this for initialization void Start() { equipmentContainer = Resources.Load <EquipmentUISlot>("GUI/Equipment_Container"); equipmentManager = EquipmentManager.instance; UIEventHandlers.OnEquipUpdate += Redraw; Redraw(); }
private void Redraw() { foreach (Transform child in EquipmentPanel.transform) { Destroy(child.gameObject); } for (int i = 0; i < equipmentManager.GetEquipsList.Length; i++) { EquipmentUISlot emptyItem = Instantiate(equipmentContainer); emptyItem.transform.SetParent(EquipmentPanel); emptyItem.SlotType = SlotType.EQUIPMENT; emptyItem.EquipType = (Enums.EquipTypes)i; equipmentSlotList.Add(emptyItem); emptyItem.SetItem(equipmentManager.GetEquipsList[i]); } }
private void Awake() { parentCanvas = GameObject.FindGameObjectWithTag("InventoryCanvas").GetComponent <Canvas>(); parentSlot = GetComponentInParent <EquipmentUISlot>(); }