/// <summary> /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler. /// </summary> protected void OnCancel(object sender, PlayerIndexEventArgs e) { OnCancel(e.PlayerIndex); }
/// <summary> /// Event handler for when the Play Game menu entry is selected. /// </summary> void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { switch (lesson) { case 1: { GameplayScreen l1 = new GameplayScreen(1); float minScore = 150; l1.AfterLoadContent = delegate() { PlayerManager pm = Costam.PlayerManager; Player pl = Costam.PlayerManager.players.Values.ElementAt(0); pl.ShootingEnabled = false; l1.objectManager.InitDiamondSequences(); l1.objectManager.VirusGenerator.Enabled = false; Trigger lessonOneTrigger = new Trigger(); lessonOneTrigger.Condition = delegate() { return(pl.score >= minScore); }; lessonOneTrigger.Action = delegate() { lessonOneTrigger.Enabled = false; ScreenManager.AddScreen(new GameOverScreen(pl.score, "Excellent!", false, 1), ControllingPlayer); }; Costam.TriggerManager.AddTrigger(lessonOneTrigger); }; LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, l1); } break; case 2: { GameplayScreen l2 = new GameplayScreen(2); float minScore = 150; l2.AfterLoadContent = delegate() { PlayerManager pm = Costam.PlayerManager; Player pl = Costam.PlayerManager.players.Values.ElementAt(0); pl.ShootingEnabled = false; l2.objectManager.InitDiamondSequences(); l2.objectManager.InitBloodSequences(); l2.objectManager.VirusGenerator.Enabled = false; Trigger lessonTwoTrigger = new Trigger(); lessonTwoTrigger.Condition = delegate() { return((pl.score >= minScore) && pl.CollisionWithRedBLoodCellHappened); }; lessonTwoTrigger.Action = delegate() { lessonTwoTrigger.Enabled = false; ScreenManager.AddScreen(new GameOverScreen(pl.score, "Congratulations!", false, 2), ControllingPlayer); }; Costam.TriggerManager.AddTrigger(lessonTwoTrigger); }; LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, l2); } break; case 3: { GameplayScreen l3 = new GameplayScreen(3); float killViruses = 10; l3.AfterLoadContent = delegate() { PlayerManager pm = Costam.PlayerManager; Player pl = Costam.PlayerManager.players.Values.ElementAt(0); pl.ShootingEnabled = true; l3.objectManager.InitDiamondSequences(); l3.objectManager.InitBloodSequences(); l3.objectManager.VirusGenerator.Enabled = true; Trigger lessonThreeTrigger = new Trigger(); lessonThreeTrigger.Condition = delegate() { return(Costam.ColisionManager.virusesKilled >= killViruses); }; lessonThreeTrigger.Action = delegate() { lessonThreeTrigger.Enabled = false; ScreenManager.AddScreen(new GameOverScreen(pl.score, "Great! You have finished all lessons", false, 3), ControllingPlayer); }; Costam.TriggerManager.AddTrigger(lessonThreeTrigger); }; LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, l3); } break; } }
/// <summary> /// Event handler for when the Play Game menu entry is selected. /// </summary> void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { ScreenManager.AddScreen(new LessonsMenuScreen(), e.PlayerIndex); }
void CreditsMenuEntrySelected(object sender, PlayerIndexEventArgs e) { ScreenManager.AddScreen(new CreditsMenuScreen(), e.PlayerIndex); }
/// <summary> /// Event handler for when the Controls menu entry is selected. /// </summary> void KinectControlsMenyEntrySelected(object sender, PlayerIndexEventArgs e) { ScreenManager.AddScreen(new KinectControlsMenuScreen(), e.PlayerIndex); }
/// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to exit" message box. /// </summary> void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { ScreenManager.Game.Exit(); }
/// <summary> /// Event handler for when the Quit Game menu entry is selected. /// </summary> void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { MediaPlayer.Play(Costam.menuSong); LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); }