// ----------------------------Ally--------------------------- void nextAlly() { selectedAlly += 1; if (selectedAlly > allyInventory.GetItemList().Count - 1) { selectedAlly = 0; } Debug.Log("Selecting :" + allyInventory.GetItemList()[selectedAlly].type); }
public void RefreshAllyInventory() { int i = 0; foreach (Transform item in transform) { if (i == 0) { } else { Destroy(item.gameObject); } i++; } foreach (Item ally in allyInventory.GetItemList()) { RectTransform allySlot = Instantiate(AllyTemplate, transform).GetComponent <RectTransform>(); allySlot.gameObject.SetActive(true); Debug.Log("Ally spawned"); Image image = allySlot.Find("allyIcon").GetComponent <Image>(); image.sprite = ally.GetSprite(); } }