void OnMouseDown() { if (state_machine.getState() == 2) { if (gameObject.CompareTag("EnemyTile") && state_machine.getAbility().manaCost <= state_machine.getCurrCharac().curr_mana) { attack(gameObject.GetComponent <Monster>()); state_machine.setState(0); bmm.closeAttackMenu(); } else { if (!gameObject.CompareTag("EnemyTile")) { Debug.Log("Wrong target!"); } else { Debug.Log("Not enough Mana!"); } } } else if (state_machine.getState() == 4) { if (gameObject.CompareTag("EnemyTile") && state_machine.getAbility().manaCost <= state_machine.getCurrCharac().curr_mana) { cast(gameObject.GetComponent <Monster>()); state_machine.setState(0); bmm.closeSpellMenu(); } else { if (!gameObject.CompareTag("EnemyTile")) { Debug.Log("Wrong target!"); } else { Debug.Log("Not enough Mana!"); } } } else if (state_machine.getState() == 5) { if (gameObject.CompareTag("PlayerTile") && state_machine.getAbility().manaCost <= state_machine.getCurrCharac().curr_mana) { castSupport(gameObject.GetComponent <Character>()); state_machine.setState(0); bmm.closeSpellMenu(); } else { if (!gameObject.CompareTag("PlayerTile")) { Debug.Log("Wrong target!"); } else { Debug.Log("Not enough Mana!"); } } } else if (state_machine.getState() == 7) { if (gameObject.CompareTag("PlayerTile")) { useItem(gameObject.GetComponent <Character>()); state_machine.setState(0); bmm.closeItemMenu(); } else { Debug.Log("Wrong target!"); } } }