public override void Update(GameTime gameTime) { #region Collisions // Gère les collisions entre IActors List <IActor> lstCollisionnable = lstActors.FindAll(actor => actor is ICollisionnable); for (int i = 0; i < lstCollisionnable.Count; i++) { IActor actor = lstCollisionnable[i]; for (int j = 0; j < lstCollisionnable.Count; j++) { IActor actor2 = lstCollisionnable[j]; ICollisionnable col = (ICollisionnable)actor; ICollisionnable col2 = (ICollisionnable)actor2; if (utils.Collide(actor, actor2)) { col.TouchedBy(col2); col2.TouchedBy(col); } } } #endregion #region Teams for (int i = 0; i < Teams.Count; i++) { if (i == IndexTeam) { Teams[i].Update(gameTime, _inTour); } else { Teams[i].Update(gameTime, false); } } Teams.RemoveAll(t => t.Remove); if (IndexTeam >= Teams.Count) { IndexTeam++; } #endregion #region Victoire / Défaite if (Teams.Count < 2 && !_gameFinnished) { _gameFinnished = true; Timer timerEnd = new Timer(3000); timerEnd.Enabled = true; timerEnd.Elapsed += TimerEnd_OnElapsed; GC.Collect(); } #endregion #region Arrêt manuel de la partie if (Input.OnReleased(Keys.Escape)) { if (IATrainingMode) { MainGame.AutoRestart = false; Population.Export("Population"); } MainGame.ChangeScene(SceneType.Menu); } #endregion base.Update(gameTime); }
static void Main() { using (var game = new MainGame()) game.Run(); }