// Update is called once per frame void Update() { if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY || GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) { if (Input.GetKeyDown(KeyCode.Space)) { if (opcao == 1) { if (itemSelect != null) { sourceAudio = null; itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { Debug.Log("pocao"); sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { Debug.Log("entrando aqui"); sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 2) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 3) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 4) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 5) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 6) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 7) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 8) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } if (opcao == 9) { if (itemSelect != null) { itemNull = itemSelect; itemSelect = null; if (itemNull.getCurrentState() == TYPE_ITEM.IN_POCAO) { inventory.removeItemSlot(opcao - 1, true); if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(20)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } } else if ((GameController.getCurrentState() == GAME_STATE.IN_BATTLE || GameController.getCurrentState() == GAME_STATE.IN_BOSS) && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE) { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.usarItemMonster(itemNull); } else { sourceAudio = addAudioSource(audios.getAudioBattle(21)); sourceAudio.Play(); usarItem.useItemBoss(itemNull); } inventory.removeItemSlot(opcao - 1, true); } else if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY && itemNull.getCurrentState() == TYPE_ITEM.IN_MAGIC) { sourceAudio = addAudioSource(audios.getAudioBattle(19)); sourceAudio.Play(); return; } else { inventory.removeItemSlot(opcao - 1, false); } } else { nullItem.Play(); } } } } }