// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space) && isActiveBau == true) { if (Input.GetKeyDown(KeyCode.Space) && fullBau == true) { foreach (AudioSource objeto in Object.FindObjectsOfType(typeof(AudioSource))) { if (objeto.tag != "Som") { objeto.Stop(); nullItem.Play(); } } return; } encontrouBau.Play(); currentSlot = inventory.selectSlot(); Debug.Log("Encontrou baú"); itemAux = findItem(); itemAux.getAudioNome().PlayDelayed(2); // informa o item achado currentSlot.setItemSlot(itemAux); Debug.Log("Você encontrou " + itemAux.getNome()); inventory.addItemSlot(itemAux, currentSlot); } }
public void addItemSlot(ItemBase item, SlotInventory slot) // adiciona item no slot { for (int i = 0; i < inventoryItems.Count; i++) { if (slot.getSlotFull() == false) { slot.setItemSlot(item); slot.setSlotFull(true); slot.setNameItem(item.getNome()); } } }