private bool InteractWithCombat() { GameObject target = player; if (target != null || fighter.CanAttack(target.gameObject)) { fighter.Atack(target.gameObject); return(true); } else { return(false); } }
private bool InteractWithCombat() { RaycastHit[] hits = Physics.RaycastAll(GetMouseRay()); foreach (RaycastHit hit in hits) { CombatTarget target = hit.transform.GetComponent <CombatTarget>(); if (target == null || !fighter.CanAttack(target.gameObject)) { continue; } if (Input.GetMouseButtonDown(1)) { fighter.Atack(target.gameObject); } return(true); } return(false); }