Пример #1
0
 private bool isDestroyerEngaged(TeamInformation ti, Destroyer ds)
 {
     if (ti.destroyerBattleList.Keys.Contains(ds))
         return true;
     else
         return false;
 }
Пример #2
0
 private void replenishFightersAndDestroyers(Game game)
 {
     foreach (TeamInformation ti in infoOnTeams)
     {
         if (!ti.fullyAIControlled)
             continue;
         int numFightersToBuy = 0;
         int numDestroyersToBuy = 0;
         int numberOfFightersOnSpawnList = 0;
         int numberOfDestroyersOnSpawnList = 0;
         foreach (DynamicObject o in ti.spawnQueue)
             if (o is Fighter)
                 numberOfFightersOnSpawnList++;
             else if (o is Destroyer)
                 numberOfDestroyersOnSpawnList++;
         if (ti.maxFighters > ti.teamFighters.Count)
         {
             if (ti.maxDestroyers <= ti.teamDestroyers.Count)
                 numFightersToBuy = (int)Math.Min(ti.teamCredits / TradingInformation.fighterCost, ti.maxFighters - ti.teamFighters.Count - numberOfFightersOnSpawnList);
             else
             {
                 numFightersToBuy = (int)Math.Min((int)(ti.teamCredits * PERCENT_OF_CREDITS_TO_SPEND_ON_FIGHTERS_WHEN_SHORT_ON_BOTH /
                     TradingInformation.fighterCost), ti.maxFighters - ti.teamFighters.Count - numberOfFightersOnSpawnList);
                 numDestroyersToBuy = (int)Math.Min((int)(ti.teamCredits * PERCENT_OF_CREDITS_TO_SPEND_ON_DESTROYERS_WHEN_SHORT_ON_BOTH /
                     TradingInformation.destroyerCost), ti.maxDestroyers - ti.teamDestroyers.Count - numberOfDestroyersOnSpawnList);
             }
         }
         else if (ti.maxDestroyers > ti.teamDestroyers.Count)
             numDestroyersToBuy = (int)Math.Min(ti.teamCredits / TradingInformation.destroyerCost,
                 ti.maxDestroyers - ti.teamDestroyers.Count - numberOfDestroyersOnSpawnList);
         for (int i = 0; i < numDestroyersToBuy; ++i)
         {
             Destroyer d = new Destroyer(game, ti.teamId, Vector3.Zero);
             d.Initialize();
             d.LoadContent();
             ti.spawnQueue.Add(d);
             ti.teamCredits -= TradingInformation.destroyerCost;
         }
         for (int i = 0; i < numFightersToBuy; ++i)
         {
             Fighter f = new Fighter(game, ti.teamId, Vector3.Zero);
             f.Initialize();
             f.LoadContent();
             ti.spawnQueue.Add(f);
             ti.teamCredits -= TradingInformation.fighterCost;
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Adds a new destroyer to the spawn queue (call this when a asset aquisition is made)
 /// </summary>
 /// <param name="ds">Instance of instantiated, registered destroyer</param>
 public void addNewDestroyerToTeam(Destroyer ds)
 {
     this.spawnQueue.Add(ds);
 }