コード例 #1
0
 public override void Update(GameTime gameTime)
 {
     foreach (IUnit unit in world.GetUnits(Team))
     {
         if (unit is BasicUnit)
         {
             ((BasicUnit)unit).Update(gameTime, world);
         }
     }
     timer += gameTime.ElapsedGameTime.Milliseconds;
     clock += gameTime.ElapsedGameTime.Milliseconds;
     //Every second modify this
     if (timer / 1000 >= 1)
     {
         ProduceResources();
         ChargeEnergy();
         Construction();
         Train();
         timer = 0;
     }
     CleanList();
     if (world.GetTiles(Team).Where(l => l is Building).Count() <= 0 && world.GetUnits(Team).Count <= 0)
     {
         //IsGameOver = true;
     }
     base.Update(gameTime);
 }
コード例 #2
0
 private void CheckGameOver()
 {
     if (world.GetUnits(2).Where(l => l is HostileMob).Count() <= 0)
     {
         if (world.GetTiles("Portal").Count() <= 0)
         {
             Won = true;
         }
     }
 }