public override void PauseGame()
        {
            if (CheckLose())
            {
                return;
            }

            base.PauseGame();

            CursorEntity.CursorView = CursorType.Normal;

            List<Button> buttons = new List<Button>();
            Color color = new Color(150, 255, 130);
            buttons.Add(new Button(color, "Continue Scanning", new ButtonPressed(ReturnToGame)));
            buttons.Add(new Button(color, "Return to Armory Console", new ButtonPressed(ReturnToArmoryConsole)));
            buttons.Add(new Button(color, "Return to Main Console", new ButtonPressed(ReturnToMainMenu)));

            pauseMenu = new TitleButtonAnnouncerEntity(new AnnouncerEnded(GoToNextWorld), color, "Pause Console", buttons);
            pauseMenu.EscapeHandler = ReturnToGame;

            PauseEntity = pauseMenu;
        }
Example #2
0
        private void NewGame()
        {
            if (!GlobalVariables.SaveExists())
            {
                //Go to the story
                GoToDriveSelector();
            }
            else
            {
                List<Button> buttons = new List<Button>();
                Color color = new Color(255, 180, 180);
                buttons.Add(new Button(color, "Yes", new ButtonPressed(DeleteSaveAndStart)));
                buttons.Add(new Button(color, "No", null));

                TitleButtonAnnouncerEntity pauseMenu = new TitleButtonAnnouncerEntity(new AnnouncerEnded(UnPauseGame), color,
                    "Delete Scan History and Start New Scan?", buttons);
                pauseMenu.ChangePosition(140);
                pauseMenu.EscapeHandler = pauseMenu.FinishAnnouncer;

                PauseEntity = pauseMenu;

                base.PauseGame();
            }
        }
Example #3
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            GlobalVariables.CheckAchievements();

            if (LevelAlarm != null)
            {
                LevelAlarm.SpeedFactor = OGE.PlayerSlowFactor;
                HUDEntity.SurvivalRemainingTime = (int)Math.Ceiling(LevelAlarm.CurrentSeconds);
            }
            else
            {
                HUDEntity.SurvivalRemainingTime = 0;
            }

            if (!levelEnded)
            {
                if (CheckLose())
                {
                    if (LevelAlarm != null)
                    {
                        LevelAlarm.Pause();
                    }

                    levelEnded = true;

                    CursorEntity.CursorView = CursorType.Normal;
                    SoundManager.ChangeMusicVolume(SoundManager.MIN_VOLUME);

                    List<Button> buttons = new List<Button>();
                    Color color = new Color(255, 180, 180);
                    buttons.Add(new Button(color, "Retry Area", new ButtonPressed(RetryLevel)));
                    if (!levelData.IsSelectedLevel())
                    {
                        buttons.Add(new Button(color, "Return to Armory Console", new ButtonPressed(ReturnToUpgradeMenu)));
                    }
                    else
                    {
                        buttons.Add(new Button(color, "Return to Sector Console", new ButtonPressed(ReturnToLevelSelector)));
                    }
                    buttons.Add(new Button(color, "Return to Main Console", new ButtonPressed(ReturnToMainMenu)));

                    TitleButtonAnnouncerEntity loseTitle = new TitleButtonAnnouncerEntity(new AnnouncerEnded(GoToNextWorld), color,
                        failReason, buttons);

                    AddOverLayer(loseTitle);
                }

                if (CheckWin())
                {
                    levelEnded = true;

                    //Convert the files
                    List<BaseEntity> files = GetCollisionEntitiesType(CollisionType.File);

                    for (int i = 0; i < files.Count; i++)
                    {
                        if (files[i] is ExeFile)
                        {
                            if (!(files[i] as ExeFile).IsInfected)
                            {
                                (files[i] as ExeFile).AddScore();
                                GlobalVariables.Achievements[typeof(ExeFile)].CurrentNumber += 1;
                            }

                            (files[i] as ExeFile).LevelEnded();
                        }

                        if (files[i] is ZipFile)
                        {
                            GlobalVariables.Achievements[typeof(ZipFile)].CurrentNumber += 1;
                        }
                    }

                    TitleTimeAnnouncerEntity winTitle = new TitleTimeAnnouncerEntity(new AnnouncerEnded(GameWin), "Sector Secured");
                    winTitle.TintColor = new Color(150, 255, 130);

                    AddOverLayer(winTitle);
                }

                if (TotalNumberOfZipFiles > 0)
                {
                    List<BaseEntity> zipFiles = GetCollisionEntitiesType(CollisionType.File);
                    List<Vector2> zipPositions = new List<Vector2>();
                    foreach (BaseFile zipFile in zipFiles)
                    {
                        if (zipFile is ZipFile)
                        {
                            zipPositions.Add(zipFile.Position);
                        }
                    }

                    HUDEntity.FileArrowEntity.UpdatePosition(zipPositions);
                }

                if (Input.CheckKeyboardButton(Keys.Escape) == GameButtonState.Pressed && !pauseGame)
                {
                    PauseGame();
                }

                if (Input.CheckKeyboardButton(Keys.F1) == GameButtonState.Pressed)
                {
                    if (tutorialEntity == null)
                    {
                        tutorialEntity = new TutorialEntity(new Color(150, 255, 130), RemoveTutorial);
                        AddEntity(tutorialEntity);
                    }
                    else
                    {
                        tutorialEntity.FinishTutorial();
                    }
                }

                if (Input.CheckLeftMouseButton() == GameButtonState.Up && Input.CheckRightMouseButton() == GameButtonState.Up)
                {
                    if (CursorEntity.IsShooting)
                    {
                        CursorEntity.IsShooting = false;
                    }
                }
            }
        }
Example #4
0
        private void ExitGame()
        {
            List<Button> buttons = new List<Button>();
            Color color = new Color(255, 180, 180);
            buttons.Add(new Button(color, "Yes", new ButtonPressed(TerminateApplication)));
            buttons.Add(new Button(color, "No", null));

            TitleButtonAnnouncerEntity pauseMenu = new TitleButtonAnnouncerEntity(new AnnouncerEnded(UnPauseGame), color,
                "Stop Scanning?", buttons);
            pauseMenu.ChangePosition(140);
            pauseMenu.EscapeHandler = pauseMenu.FinishAnnouncer;

            PauseEntity = pauseMenu;

            base.PauseGame();
        }