private IEnumerable <IPlayer> RayCast(Vector2 start, Vector2 end) { if (HasDamage(TurretDamage.SensorDamaged)) { foreach (var result in RayCastHelper.Players(start, end)) { yield return(Game.GetPlayer(result.ObjectID)); } } else { foreach (var result in RayCastHelper.Players(start, end, true, Team, Owner)) { yield return(Game.GetPlayer(result.ObjectID)); } } }
private bool HasTargetToCharge() { var los = GetLineOfSight(); var lineStart = los[0]; var lineEnd = los[1]; foreach (var result in RayCastHelper.Players(lineStart, lineEnd)) { var player = Game.GetPlayer(result.ObjectID); var inMinimumRange = ScriptHelper.IntersectCircle( player.GetAABB(), Actor.Position, ChargeMinimumRange); if (!inMinimumRange && !player.IsDead && !player.IsInMidAir && !ScriptHelper.SameTeam(player, Player)) { return(true); } } return(false); }