Exemplo n.º 1
0
 public override void SetTarget(IGameObject target)
 {
     if (target != this.m_CurrentTarget)
     {
         int          targetId = 0;
         CombatStance stance   = CombatStance.NO_STANCE;
         float        num      = 0.0f;
         if (target != null)
         {
             targetId = target.ObjectID;
             stance   = CombatStance.PURSUE;
             num      = Math.Max(CombatAI.GetMinEffectiveWeaponRange(this.m_Protean, false), 500f);
         }
         this.m_Protean.SetCombatStance(stance);
         this.m_Protean.SetShipTarget(targetId, Vector3.Zero, true, 0);
         this.m_Protean.Maneuvering.PostSetProp("SetStanceTarget", (object)targetId, (object)num);
     }
     this.m_CurrentTarget = target;
 }
Exemplo n.º 2
0
        private TaskGroupShipControl CreateFlankAttackGroups(
            List <Ship> ships,
            Vector3 attackVec)
        {
            float num = 0.0f;

            foreach (Ship ship in ships)
            {
                num += CombatAI.GetMinEffectiveWeaponRange(ship, false);
            }
            float            minDist          = num / (float)ships.Count * 0.75f;
            float            desiredDist      = minDist + 500f;
            FlankShipControl flankShipControl = new FlankShipControl(this.m_Game, this.m_Objective, this.m_CommanderAI, attackVec, minDist, desiredDist);

            foreach (Ship ship in ships)
            {
                flankShipControl.AddShip(ship, (this.m_Type == TaskGroupType.Aggressive || this.m_Type == TaskGroupType.Passive) && TaskGroup.GetTaskTypeFromShip(ship) == TaskGroupType.Civilian);
            }
            return((TaskGroupShipControl)flankShipControl);
        }
Exemplo n.º 3
0
 protected void ThinkTrack()
 {
     --this.m_ResetTargetRate;
     if (this.m_Target == null || this.m_ResetTargetRate <= 0)
     {
         if (this.m_Target == null)
         {
             this.m_HoldPosDuration = 0;
             this.m_ResetHoldPos    = 0;
         }
         this.SetTarget((IGameObject)null);
         this.m_State = SwarmerSpawnerStates.SEEK;
     }
     else
     {
         --this.m_TrackRate;
         if (this.m_TrackRate > 0)
         {
             return;
         }
         this.m_TrackRate = 3;
         Vector3 vector3_1 = Vector3.Zero;
         if (this.m_Target is Ship)
         {
             vector3_1 = (this.m_Target as Ship).Position;
         }
         float   num1     = Math.Max(1500f, CombatAI.GetMinEffectiveWeaponRange(this.m_SwarmerSpawner, false));
         Vector3 position = vector3_1;
         position.Y = 0.0f;
         Vector3 vector3_2 = position - this.m_SwarmerSpawner.Position;
         vector3_2.Y = 0.0f;
         Vector3 look          = Vector3.Normalize(vector3_2);
         Vector3 forward       = look;
         float   num2          = num1 + 500f;
         float   num3          = 0.0f;
         float   lengthSquared = vector3_2.LengthSquared;
         if ((double)lengthSquared < (double)num2 * (double)num2)
         {
             if (this.m_HoldPosDuration <= 0)
             {
                 if ((double)lengthSquared > (double)num3 * (double)num3)
                 {
                     this.m_ResetHoldPos -= this.m_TrackRate;
                     if (this.m_ResetHoldPos <= 0)
                     {
                         Random random = new Random();
                         this.m_CurrMaxResetHoldPos = random.NextInclusive(600, 800);
                         this.m_ResetHoldPos        = this.m_CurrMaxResetHoldPos;
                         this.m_HoldPosDuration     = 600;
                         this.m_RotDir   = random.CoinToss(0.5) ? -1f : 1f;
                         this.m_HoldDist = vector3_2.Length * 0.9f;
                     }
                 }
                 forward = (Matrix.CreateRotationY(this.m_RotDir * MathHelper.DegreesToRadians(30f)) * Matrix.CreateWorld(position, forward, Vector3.UnitY)).Forward;
             }
         }
         else
         {
             this.m_ResetHoldPos    = this.m_CurrMaxResetHoldPos;
             this.m_HoldPosDuration = 0;
         }
         if (this.m_HoldPosDuration > 0)
         {
             this.m_HoldPosDuration -= this.m_TrackRate;
             num1 = this.m_HoldDist;
         }
         this.m_SwarmerSpawner.Maneuvering.PostAddGoal(position - forward * num1, look);
     }
 }