private void Select() { MainGame.IATrainingMode = false; switch (_groupMenu.CurrentSelection) { case 0: MainGame.ChangeScene(SceneType.Gameplay); break; case 1: MainGame.ChangeScene(SceneType.HowToPlay); break; case 2: MainGame.ExitGame = true; break; case 3: MainGame.IATrainingMode = true; MainGame.NumberOfTeam = 15; MainGame.NumberOfTank = 2; MainGame.AutoRestart = true; MainGame.ChangeScene(SceneType.Gameplay); break; default: break; } }
private void Textbox_OnClick(object sender, ClickType Clicks) { if (_currentTimerIntro >= TIMER_INTRO && Clicks == ClickType.Left) { MainGame.ChangeScene(SceneType.Menu); } }
public override void Update(GameTime gameTime) { _tweeningPlay.Update(gameTime); _tweeninghowToPlay.Update(gameTime); _tweeningExit.Update(gameTime); _tweeningTrainingMode.Update(gameTime); _play.Position = new Vector2(_tweeningPlay.Result, _play.Position.Y); _howToPlay.Position = new Vector2(_tweeninghowToPlay.Result, _howToPlay.Position.Y); _exit.Position = new Vector2(_tweeningExit.Result, _exit.Position.Y); _trainingMode.Position = new Vector2(_tweeningTrainingMode.Result, _trainingMode.Position.Y); _tweeningNbOfTeamDescription.Update(gameTime); _numberOfTeamDescription.Position = new Vector2(_tweeningNbOfTeamDescription.Result, _numberOfTeamDescription.Position.Y); for (int i = 0; i < _tweeningNbOfTeam.Length; i++) { _tweeningNbOfTeam[i].Update(gameTime); _numberOfTeam[i].Position = new Vector2(_tweeningNbOfTeam[i].Result, _numberOfTeam[i].Position.Y); } _tweeningNbOfTankDescription.Update(gameTime); _numberOfTankDescription.Position = new Vector2(_tweeningNbOfTankDescription.Result, _numberOfTankDescription.Position.Y); for (int i = 0; i < _tweeningNbOfTank.Length; i++) { _tweeningNbOfTank[i].Update(gameTime); _numberOfTank[i].Position = new Vector2(_tweeningNbOfTank[i].Result, _numberOfTank[i].Position.Y); } if (_currentTimerIntro < TIMER_INTRO) { _currentTimerIntro += (float)gameTime.ElapsedGameTime.TotalSeconds; _backgroundColor = Color.Lerp(Color.Transparent, Color.White, _currentTimerIntro / TIMER_INTRO); } else { if (Input.OnPressed(Keys.Up)) { _groupMenu.CurrentSelection--; } if (Input.OnPressed(Keys.Down)) { _groupMenu.CurrentSelection++; } if (Input.OnPressed(Keys.Enter) || Input.OnPressed(Keys.Space)) { Select(); } } if (MainGame.AutoRestart) { MainGame.IATrainingMode = true; MainGame.NumberOfTeam = 15; MainGame.NumberOfTank = 2; MainGame.ChangeScene(SceneType.Gameplay); } base.Update(gameTime); }
private void Select() { switch (_groupMenu.CurrentSelection) { case 0: MainGame.ChangeScene(SceneType.Menu); break; case 1: MainGame.ExitGame = true; break; default: break; } }
public override void Update(GameTime gameTime) { if (_currentTimerIntro < TIMER_INTRO) { _currentTimerIntro += (float)gameTime.ElapsedGameTime.TotalSeconds; _backgroundColor = Color.Lerp(Color.Transparent, Color.White, _currentTimerIntro / TIMER_INTRO); } else { if (Input.OnPressed(Keys.Enter) || Input.OnPressed(Keys.Space) || Input.OnPressed(Keys.Escape)) { MainGame.ChangeScene(SceneType.Menu); } } base.Update(gameTime); }
private void TimerEnd_OnElapsed(object sender, ElapsedEventArgs e) { if (IATrainingMode) { Population.Export("Population"); MainGame.ChangeScene(SceneType.Menu); } else { if (Teams.Count == 1) { MainGame.Winner = Teams[0].ToString(); MainGame.ChangeScene(SceneType.Victory); } else { MainGame.ChangeScene(SceneType.Gameover); } } ((Timer)sender).Elapsed -= TimerEnd_OnElapsed; }
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); }