コード例 #1
0
 public bool IsDetected(CombatAI detectingAi)
 {
     foreach (Ship ship in this.m_Ships)
     {
         if (detectingAi.IsShipDetected(ship))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }