The whole function can be concisely expressed as `return target.IsValid && IsInRange(attackOrigin, range, target.CenterLocation);`