Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="c">Content Manager</param>
        /// <param name="b">Bounding Rectangle - Displays the menu of set size</param>
        public GameOver(ContentManager c, Rectangle b)
            : base(c, b)
        {
            //Initialize Everything
            items = new List<MenuItem>();

            restart = new Button(new Vector2(300.0f, 200.0f), c.Load<Texture2D>("restart"));
            quit = new Button(new Vector2(300.0f, 300.0f), c.Load<Texture2D>("quit"));

            //Add everything to the array of items.
            isActive = true;
            items.Add(restart);
            items.Add(quit);

            //Finish some initialization
            content = c;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="c">Content Manager</param>
        /// <param name="p">The Player</param>
        /// <param name="b">Bounding Rectangle - Displays the menu of set size</param>
        /// <param name="w">The World that the Game takes place in</param>
        public MainMenu(ContentManager c, Rectangle b)
            : base(c, b)
        {
            //Initialize Everything
            items = new List<MenuItem>();

            MenuTex = c.Load<Texture2D>("mainmenu");
            play = new Button(new Vector2(300.0f, 100.0f), c.Load<Texture2D>("start"));
            quit = new Button(new Vector2(300.0f, 200.0f), c.Load<Texture2D>("quit"));
            buttonClick = c.Load<SoundEffect>("Audio/WAVs/Buttons/button2");

            //Add everything to the array of items.
            isActive = true;
            items.Add(play);
            items.Add(quit);

            //Finish some initialization
            content = c;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="c">Content Manager</param>
        /// <param name="b">Bounding Rectangle - Displays the menu of set size</param>
        public GameOver(ContentManager c, Rectangle b, World w, Powerup power)
            : base(c, b)
        {
            //Initialize Everything
            items = new List<MenuItem>();
            world = w;
            pUp = power;
            MenuTex = c.Load<Texture2D>("gameover");
            restart = new Button(new Vector2(300.0f, 200.0f), c.Load<Texture2D>("restart"));
            quit = new Button(new Vector2(300.0f, 300.0f), c.Load<Texture2D>("quit"));
            score = new Label(new Vector2(100.0f, 100.0f), c.Load<Texture2D>("quit"), "Your Score: " + w.score/10 + " meters");
            try
            {
                StreamReader reader = new StreamReader("highScore.txt");
                high = Double.Parse(reader.ReadLine());
                reader.Close();
                if (high < w.score)
                {
                    high = w.score;
                    StreamWriter writer = new StreamWriter("highScore.txt", false);
                    writer.Write(Math.Round(high, 2));
                    writer.Close();
                }
            }
            catch (Exception e)
            {
                high = w.score;
                StreamWriter writer = new StreamWriter("highScore.txt", false);
                writer.Write(Math.Round(high, 2));
                writer.Close();
            }
            highScore = new Label(new Vector2(100.0f, 150.0f), c.Load<Texture2D>("quit"), "High Score: " + Math.Round(high, 2) / 10 + " meters");
            buttonClick = c.Load<SoundEffect>("Audio/WAVs/Buttons/button2");

            //Add everything to the array of items.
            isActive = true;
            items.Add(restart);
            items.Add(quit);
            items.Add(score);
            items.Add(highScore);
            //Finish some initialization
            content = c;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="c">Content Manager</param>
        /// <param name="p">The Player</param>
        /// <param name="b">Bounding Rectangle - Displays the menu of set size</param>
        /// <param name="w">The World that the Game takes place in</param>
        public PauseMenu(ContentManager c, Rectangle b, World w, Powerup power)
            : base(c, b)
        {
            //Initialize Everything
            items = new List<MenuItem>();
            world = w;
            pUp = power;

            resume = new Button(new Vector2(300.0f, 150.0f), c.Load<Texture2D>("continue"));
            restart = new Button(new Vector2(300.0f, 250.0f), c.Load<Texture2D>("restart"));
            quit = new Button(new Vector2(300.0f, 350.0f), c.Load<Texture2D>("quit"));
            buttonClick = c.Load<SoundEffect>("Audio/WAVs/Buttons/button2");

            //Add everything to the array of items.
            isActive = true;
            items.Add(resume);
            items.Add(restart);
            items.Add(quit);

            //Finish some initialization
            content = c;
        }