Пример #1
0
        /// <summary>
        /// Aktualisiert den Loadingscreen
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
            text.Update();
            head.Update();
            // Wenn alle gamescreen deaktiviert sind beginnt das laden
            if (otherScreensAreGone)
            {
                ScreenManager.RemoveScreen(this);

                foreach (GameScreen screen in screensToLoad)
                {
                    if (screen != null)
                    {
                        ScreenManager.AddScreen(screen, ControllingPlayer);
                        ExitScreen();
                    }
                }

                // Gametimer wird zurückgesetzt
                ScreenManager.Game.ResetElapsedTime();
            }
        }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            if (myTime % 30 == 0)
            {
                m_countdown--;
            }

            gameOver();

            if (myTime == 59 && !deathApplied)
            {
                screenManager.audioFileSystem.s_levelOneTheme.Play();
            }


            if (myTime <= 59 && !deathApplied && !victoryApplied)
            {
                bouncingText.Update();
                flyinghead.Update();
            }

            if (LevelWon())
            {
                Highscore.PutHighScore("", player.getScore());
                Highscore.SaveHighscore();
            }
            else
            {
                myTime += 1.0f;
                if (!bossThemeStarted)
                {
                    controlMusic();
                }
                player.Update(gameTime);

                collision.Update(gameTime);

                levelEins.Update(gameTime, player);                                 // draws the level related to the xml file

                m_Background1.Update(gameTime);
                m_Background2.Update(gameTime);
                m_Background3.Update(gameTime);
                m_Background4.Update(gameTime);
                m_Background5.Update(gameTime);
                player.setXVelocity(0f);


                if (player.getActiv())
                {
                    if (b_touchState == true)
                    {
                        helper.updateInput(listOfTouchLocations);
                        helper.readInput(gameTime, listOfTouchLocations, player);
                    }
                    else
                    {
                        playerInput.Update(gameTime);
                    }
                }
            }
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }