void OnMouseOver() { if (Input.GetMouseButtonDown(1)) { if (dist <= 3.5f) { MagicSkill.magTar = transform; MagicSkill.eDef = Mathf.RoundToInt(def); magSkill.Attack(); } else { theDM.dLines = new string[1]; theDM.dLines[0] = "You're too far away. Get closer!"; theDM.currentLine = 0; theDM.ShowDialog(); } } }
void OnMouseOver() { if (Input.GetMouseButtonDown(1)) { if (Vector3.Distance(player.transform.position, transform.position) <= 3.5f) { MagicSkill.magTar = transform; MagicSkill.eDef = Mathf.RoundToInt(eDefense); magSkill.Attack(); } else { theDM.dLines = new string[1]; theDM.dLines[0] = "You're too far away. Get closer!"; theDM.currentLine = 0; theDM.ShowDialog(); Debug.Log("Get Closer!"); } } }