Пример #1
0
        /// <summary>
        /// update timer
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            time += (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (time >= 5)
            {
                ScreenManager.ChangeScreens(this, ScreenOrder.IdToScreen(LevelData.Load().LastScreen));
            }


            base.Update(gameTime);
        }
Пример #2
0
        /// <summary>
        /// update game logic
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            startButton.Update();
            optionsButton.Update();
            creditsButton.Update();
            exitButton.Update();
            resetButton.Update();

            if (startButton.Clicked)
            {
                ScreenManager.ChangeScreens(this, ScreenOrder.IdToScreen(LevelData.Load().LastScreen));
            }
            if (optionsButton.Clicked)
            {
                optionsButton.Clicked = false;
                ScreenManager.AddScreen(new SettingsScreen());
            }
            if (creditsButton.Clicked)
            {
                ScreenManager.ChangeScreens(this, new CreditsScreen());
            }
            if (exitButton.Clicked)
            {
                ScreenManager.ExitGame = true;
            }

            if (resetButton.Clicked)
            {
                LevelData levelData = LevelData.Load();
                levelData.LastScreen = ScreenOrder.ScreenToId(new PrologueScreen());
                levelData.GroupIndex = 0;
                levelData.LevelIndex = 0;
                levelData.Save();

                PlayerData playerData = PlayerData.Load();
                playerData.Health    = 5;
                playerData.FlaskUses = 3;
                playerData.Save();

                resetButton.Clicked = false;
            }

            base.Update(gameTime);
        }