Exemplo n.º 1
0
        public void updategame(float gtime)
        {
            // Main game code
            if (!gameover)
            {
                // Game is being played
                robot.moveme(pad[0], gtime, 70);

                // Allow robot to jump
                if (pad[0].Buttons.RightShoulder == ButtonState.Pressed)
                {
                    robot.jump(50);
                }

                // Set the camera to first person
                gamecamera.setFPor3P(robot.position, robot.direction, new Vector3(0, 0, 0), -60, 300, 60, 45);
                // Set side on camera view
                gamecamera.setsideon(robot.position, robot.rotation, 500, 50);
                // Set overhead camera view
                gamecamera.setoverhead(robot.position, 1000);
                // Set the camera to third person
                gamecamera.setFPor3P(robot.position, robot.direction, robot.velocity, 300, 100, 100, 60);


                // Allow the camera to look up and down
                gamecamera.position.Y += (pad[0].ThumbSticks.Right.Y * 140);

                // Spin flying saucer object
                tree[51].rotation.Y += 0.1f;

                if (keys.IsKeyDown(Keys.Escape) || pad[0].Buttons.Back == ButtonState.Pressed)
                {
                    gameover = true;    // End Game
                }
            }
            else
            {
                // Game is over

                // Allow game to return to the main menu
                if (keys.IsKeyDown(Keys.Escape) || pad[0].Buttons.B == ButtonState.Pressed)
                {
                    // SORT HIGH SCORE TABLE
                    Array.Sort(highscores, highscorenames);
                    Array.Reverse(highscores);
                    Array.Reverse(highscorenames);

                    gamestate = -1;
                }
            }
        }