//***Attack Functions*** public void openAttackMenu() { if (state_machine.getState() == 1) { spell_button.SetActive(false); item_button.SetActive(false); action_menu.SetActive(true); } }
void OnMouseDown() { if (state_machine.getState() == 0) { if (gameObject.CompareTag("PlayerTile")) { if (playerPanel.activeSelf == false) { playerPanel.SetActive(true); } if (actionPanel.activeSelf == false) { actionPanel.SetActive(true); } state_machine.setCurrCharac(gameObject.GetComponent <Character>()); if (gameObject.GetComponent <Character>().skills.Count == 0) { gameObject.GetComponent <Character>().fillAbilities(); } img.texture = GetComponent <Character>().pic; charName.text = GetComponent <Character>().charName; hpValue.text = gameObject.GetComponent <Character>().curr_health.ToString() + "/" + gameObject.GetComponent <Character>().max_health.ToString(); mpValue.text = gameObject.GetComponent <Character>().curr_mana.ToString() + "/" + gameObject.GetComponent <Character>().max_mana.ToString(); atkValue.text = gameObject.GetComponent <Character>().attack.ToString(); defValue.text = gameObject.GetComponent <Character>().defense.ToString(); magValue.text = gameObject.GetComponent <Character>().magic_attack.ToString(); float resMulti = gameObject.GetComponent <Character>().fireRes * 100; fireRes.text = resMulti.ToString() + "%"; resMulti = gameObject.GetComponent <Character>().wtrRes * 100; wtrRes.text = resMulti.ToString() + "%"; resMulti = gameObject.GetComponent <Character>().elecRes * 100; elecRes.text = resMulti.ToString() + "%"; resMulti = gameObject.GetComponent <Character>().holyRes * 100; holyRes.text = resMulti.ToString() + "%"; resMulti = gameObject.GetComponent <Character>().darkRes * 100; darkRes.text = resMulti.ToString() + "%"; } } }
void Update() { if (Input.GetMouseButtonDown(1)) { if (state_machine.getState() == 1 || state_machine.getState() == 2) { state_machine.setState(0); bmm.closeAttackMenu(); state_machine.setAbility(null); } else if (state_machine.getState() == 3 || state_machine.getState() == 4 || state_machine.getState() == 5) { state_machine.setState(0); bmm.closeSpellMenu(); state_machine.setAbility(null); } else if (state_machine.getState() == 6 || state_machine.getState() == 7) { state_machine.setState(0); bmm.closeItemMenu(); state_machine.setCurrItem(null); } } }