コード例 #1
0
ファイル: GuardOwnPlanet.cs プロジェクト: bethge/GalaticChaos
 public void AssignVolunteers(int needed)
 {
     Debug.Assert(mParent.mCurrentIdleUnits.Count >= needed);
     for (int i = 0; i < needed; i++)
     {
         GuardOwnPlanet exercise = new GuardOwnPlanet(mParent, mPlanet);
         mParent.AddExercise(mParent.mCurrentIdleUnits[mParent.mCurrentIdleUnits.Count - 1],
             exercise);
     }
 }
コード例 #2
0
ファイル: SpaceshipAi.cs プロジェクト: bethge/GalaticChaos
 private void TryAttachNonCrusadeExercises()
 {
     // Planet Defense
     List<Planet> keys = new List<Planet>(mPlanetDefenseUrgencies.Keys);
     foreach(Planet key in keys)
     {
         int urgency = mPlanetDefenseUrgencies[key];
         int toAssign = (mCurrentIdleUnits.Count < urgency) ? mCurrentIdleUnits.Count : urgency;
         if (toAssign > 0)
         {
             GuardOwnPlanet exercise = new GuardOwnPlanet(this, key);
             exercise.AssignVolunteers(toAssign);
             exercise.AddUrgency(-toAssign);
         }
     }
     // Planet Blocking
     keys = new List<Planet>(mEnemyPlanetBlockUrgencies.Keys);
     foreach (Planet key in keys)
     {
         int urgency = mEnemyPlanetBlockUrgencies[key];
         int toAssign = (mCurrentIdleUnits.Count < urgency) ? mCurrentIdleUnits.Count : urgency;
         if (toAssign > 0)
         {
             BlockEnemyPlanet exercise = new BlockEnemyPlanet(this, key);
             exercise.AssignVolunteers(toAssign);
             exercise.AddUrgency(-toAssign);
         }
     }
 }