public void useItem() { if (this.itemName == "Potion") { Ouros = FindObjectOfType <Ouros>(); if (Ouros.HP != Ouros.maxHP) { if (Ouros.HP + 100 > Ouros.maxHP) { Ouros.HP = Ouros.maxHP; } else { Ouros.HP += 100; } Ouros.item.amount -= 1; } } if (this.itemName == "Ether") { Ouros = FindObjectOfType <Ouros>(); if (Ouros.magic.unLimit == false) { Ouros.GetComponent <Ouros>().magic.charge += 5; Ouros.item.amount -= 1; } } }
void itemGet() { d.Opic = this.icon; if (this.isConsumable == true) { d.Otex = this.itemName + " x " + this.amount; } else { d.Otex = this.itemName; } d.Obtain(); skillGet(); Item hand = Ouros.item; if (this.key == false) { for (int i = 1; i < Ouros.itemList.Length; i++) { if (Ouros.itemList[i].itemName == this.itemName) { Ouros.itemList[i].amount += this.amount; } Destroy(gameObject); if (Ouros.GetComponent <Move>().isOnGround == true) { Ouros.GetComponent <Move>().isOnGround = true; } } } else { keyItem(); } }