// Update is called once per frame void Update() { //DEBUG CODE GameObject g1 = null, g2 = null; if (swap && !GameObject.FindGameObjectWithTag("ItemBarHolder").GetComponent <ItemBar>().IsOnCooldown()) { if (spot1.Contains("h")) { g1 = iBar.GetItemAtSpot(spot1); } if (spot1.Contains("i")) { g1 = iScreen.GetItemAtSpot(spot1); } if (spot2.Contains("h")) { g2 = iBar.GetItemAtSpot(spot2); } if (spot2.Contains("i")) { g2 = iScreen.GetItemAtSpot(spot2); } if (spot1.Contains("h")) { iBar.AddItemAtSpot(g2, spot1); iBar.updateAttacks(); } else if (spot1.Contains("i")) { iScreen.AddItemAtSpot(g2, spot1); iScreen.hideIcons(); iScreen.showIcons(); } if (spot2.Contains("h")) { iBar.AddItemAtSpot(g1, spot2); iBar.updateAttacks(); } else if (spot2.Contains("i")) { iScreen.AddItemAtSpot(g1, spot2); iScreen.hideIcons(); iScreen.showIcons(); } swap = false; GameObject.FindGameObjectWithTag("c1").GetComponent <Image>().enabled = false; GameObject.FindGameObjectWithTag("c2").GetComponent <Image>().enabled = false; spot1 = ""; spot2 = ""; } }
// Use this for initialization void Start() { myHotbar = hotbar.GetComponent <ItemBar>(); myInventory = inventory.GetComponent <InventoryScreen>(); myLoadout = loadoutPrefab.GetComponent <Loadout>(); int i = 0; foreach (GameObject obj in myLoadout.GetHotbar()) { myHotbar.AddItemAtSpot(obj, "h" + i); i++; } i = 0; foreach (GameObject obj in myLoadout.GetInventory()) { myInventory.AddItemAtSpot(obj, "i" + i); i++; } }