public bool characterWithinAttackDistance(CharacterInstance attacker, CharacterInstance target) { if ((attacker == null) || (target == null)) { return(false); } Vector3 position = attacker.PhysicsBody.Transform.position; return(Vector3.Distance(Vector3Extensions.ToXzVector3(target.PhysicsBody.Transform.position), position) <= (attacker.AttackRange(true) + target.Radius)); }