void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "item") { itemControl ic = (itemControl)col.gameObject.GetComponent("itemControl"); AddItem(ic.myTex, ic.myObject); Destroy(col.gameObject); } }
public void WorkSelected() { equipment eq = (equipment)GetComponent("equipment"); itemControl ic = (itemControl)selectedItem.GetComponent("itemControl"); if (Input.GetKeyDown(KeyCode.F)) { if (selectedY >= 0) { selectedItem = itemsInInventory[(int)(selectedX + selectedY * Cols) + 2]; } else { /*if(selectedX < 1 && ic.itemType == "armour"){ * if(ic.moreSpecific == "helm" && selectedY == -3){ * //itemsInInventory.Add(eq.armour[0]); * //itemTextures.Add(eq.amourTex[0]); * * eq.armour.Remove(eq.armour[0]); * eq.armour[0] = selectedItem; * * Debug.Log("should work"); * } * if(ic.moreSpecific == "chestPlate" && selectedY == -2){ * itemsInInventory.Add(eq.armour[1]); * eq.armour.Remove(eq.armour[1]); * eq.armour[1] = selectedItem; * } * if(ic.moreSpecific == "arms" && selectedY == -1){ * itemsInInventory.Add(eq.armour[2]); * eq.armour.Remove(eq.armour[2]); * eq.armour[2] = selectedItem; * } * if(ic.moreSpecific == "legs" && selectedY == 0){ * itemsInInventory.Add(eq.armour[3]); * eq.armour.Remove(eq.armour[3]); * eq.armour[3] = selectedItem; * Debug.Log("tag issues"); * } * Debug.Log("need fewer if's"); * }else*/if (ic.itemType == "weapon") { if (selectedX == 1 && selectedY == -4) { eq.weapons[0] = selectedItem; itemsInInventory.Add(eq.weapons[0]); itemTextures.Add(eq.weaponsTex[0]); } if (selectedX == 2 && selectedY == -4) { //itemsInInventory.Add(eq.weapons[0]); //itemTextures.Add(eq.weaponsTex[0]); //eq.armour.Remove(eq.armour[0]); eq.weapons[1] = selectedItem; } if (selectedX == 1 && selectedY == -3) { //itemsInInventory.Add(eq.weapons[0]); //itemTextures.Add(eq.weaponsTex[0]); //eq.armour.Remove(eq.armour[0]); eq.weapons[2] = selectedItem; } if (selectedX == 2 && selectedY == -3) { //itemsInInventory.Add(eq.weapons[0]); //itemTextures.Add(eq.weaponsTex[0]); //eq.armour.Remove(eq.armour[0]); eq.weapons[3] = selectedItem; } if (selectedX == 1 && selectedY == -2) { //itemsInInventory.Add(eq.weapons[0]); //itemTextures.Add(eq.weaponsTex[0]); //eq.armour.Remove(eq.armour[0]); eq.weapons[4] = selectedItem; } if (selectedX == 2 && selectedY == -2) { //itemsInInventory.Add(eq.weapons[0]); //itemTextures.Add(eq.weaponsTex[0]); //eq.armour.Remove(eq.armour[0]); eq.weapons[5] = selectedItem; } if (selectedX == 1 && selectedY == -1) { //itemsInInventory.Add(eq.weapons[0]); //itemTextures.Add(eq.weaponsTex[0]); //eq.armour.Remove(eq.armour[0]); eq.weapons[6] = selectedItem; } if (selectedX == 2 && selectedY == -1) { //itemsInInventory.Add(eq.weapons[0]); //itemTextures.Add(eq.weaponsTex[0]); //eq.armour.Remove(eq.armour[0]); eq.weapons[7] = selectedItem; } } else if (selectedX > 2 && ic.itemType != "amo") { } Debug.Log("well, the button works"); } } }