void UseItem() { if (items[cursorIndex].arma != null) { player.AddArma(items[cursorIndex].arma); } else if (items[cursorIndex].itemConsumivel != null) { player.UseIten(items[cursorIndex].itemConsumivel); inventory.RemoveItem(items[cursorIndex].itemConsumivel); cursorIndex = 0; RefreshItemList(); UpdateItemsList(2); scrollVertical.value = 1; } else if (items[cursorIndex].armadura != null) { player.AddArmadura(items[cursorIndex].armadura); } UpdateAtributes(); if (items.Count > 0) { UpdateDescription(); } else { descriptionText.text = ""; } }
private void OnTriggerEnter2D(Collider2D collision) { Player_Controller player = collision.GetComponent <Player_Controller>(); Debug.Log("teste2"); if (player != null) { player.AddArma(arma); Inventory.inventory.AddWeapon(arma); Destroy(gameObject); } }