public bool IsDetected(CombatAI detectingAi) { foreach (Ship ship in this.m_Ships) { if (detectingAi.IsShipDetected(ship)) { return(true); } } return(false); }
public Ship GetClosestShip(Vector3 fromCoords, CombatAI detectingAi) { Ship ship1 = (Ship)null; float num = 0.0f; foreach (Ship ship2 in this.m_Ships) { if (detectingAi.IsShipDetected(ship2)) { float lengthSquared = (fromCoords - ship2.Maneuvering.Position).LengthSquared; if (ship1 == null || (double)lengthSquared < (double)num) { ship1 = ship2; num = lengthSquared; } } } return(ship1); }
public Vector3 GetAverageVelocity(CombatAI detectingAi) { Vector3 zero = Vector3.Zero; int num = 0; foreach (Ship ship in this.m_Ships) { if (detectingAi.IsShipDetected(ship)) { zero += ship.Maneuvering.Velocity; ++num; } } if (num > 0) { zero /= (float)num; this.m_LastKnownHeading = zero; } return(zero); }