Beispiel #1
0
        /// <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>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            if (levelNum < myLevels.Count)
            {
                myLevels[levelNum].Update(gameTime);
                if (myLevels[levelNum].myLevelManager.getIsFinished())
                {
                    playerScore.Add(myLevels[levelNum].myLevelManager.finishingTime);

                    // This effectively resets to the first level but game
                    // finished screen with all the times doesn't get displayed

                    if (levelNum == myLevels.Count() - 1)
                    {
                        levelNum = 1;
                        // LoadContent();

                        mySpriteBatch = new SpriteBatch(GraphicsDevice);

                        Asis myAsis2 = new Asis(Content.Load<Texture2D>("Asis"), new Vector2(0, 0),
                            new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), this);

                        camera = new Camera(GraphicsDevice.Viewport, myAsis2);

                        Tutorial TutorialContent = new Tutorial(this, graphics, myAsis2, mySpriteBatch);
                        Ceres firstLevelContent = new Ceres(this, graphics, myAsis2, mySpriteBatch);
                        //level = new Tutorial(this, graphics, myAsis, mySpriteBatch);
                        Vulkanis secondLevelContent = new Vulkanis(this, graphics, myAsis2, mySpriteBatch);
                        Sycia thirdLevelContent = new Sycia(this, graphics, myAsis2, mySpriteBatch);
                        myLevels.Clear();
                        myLevels.Add(TutorialContent);
                        myLevels.Add(firstLevelContent);
                        myLevels.Add(secondLevelContent);
                        myLevels.Add(thirdLevelContent);
                        //add another screen for the finishing times!!!
                        FinishTimes = new Screen(Content.Load<Texture2D>("FinalTimes"), new Vector2(0, 0), new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
                        timesFont = Content.Load<SpriteFont>("FinishTimesFont");

                    }else

                    levelNum++;
                }
            }
            else
            {
                if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Start))
                {
                    levelNum = 0;
                    playerScore = new List<double>();
                }
            }

            camera.Update(gameTime);
            base.Update(gameTime);
        }
Beispiel #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            mySpriteBatch = new SpriteBatch(GraphicsDevice);

            Asis myAsis = new Asis(Content.Load<Texture2D>("Asis"), new Vector2(0,0),
                new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), this);

            camera = new Camera(GraphicsDevice.Viewport, myAsis);

            Tutorial TutorialContent = new Tutorial(this, graphics, myAsis, mySpriteBatch);
            Ceres firstLevelContent = new Ceres(this, graphics, myAsis, mySpriteBatch);
            //level = new Tutorial(this, graphics, myAsis, mySpriteBatch);
            Vulkanis secondLevelContent = new Vulkanis(this, graphics, myAsis, mySpriteBatch);
            Sycia thirdLevelContent = new Sycia(this, graphics, myAsis, mySpriteBatch);
            myLevels.Add(TutorialContent);
            myLevels.Add(firstLevelContent);
            myLevels.Add(secondLevelContent);
            myLevels.Add(thirdLevelContent);
            //add another screen for the finishing times!!!
            FinishTimes = new Screen(Content.Load<Texture2D>("FinalTimes"), new Vector2(0, 0), new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
            timesFont = Content.Load<SpriteFont>("FinishTimesFont");
        }