Пример #1
0
        public MainMenuState(Game game)
            : base(game)
        {
            //Re-initialize score and lives for a new game.
            GUIVariables.score = 0;
            GUIVariables.lives = 3;

            input = ContentStorageManager.Get<InputController>("input");

            //Create and set buttons
            Dictionary<string, ImageButton.Callback> menuButtons = new Dictionary<string, ImageButton.Callback>();
            menuButtons.Add("MainMenuStart", startButton);
            menuButtons.Add("MainMenuQuit", quitButton);

            //initialize menu
            MainMenu = new Menu(game, menuButtons, HLayout.Left, VLayout.Bottom, new Vector2(0, 0), 10); // HLayout is CENTER for PC

            titleLogo = game.Content.Load<Texture2D>("ParasiteTitle");
            Position.X -= 658 / 2 - game.GraphicsDevice.PresentationParameters.BackBufferWidth / 2;
            Position.Y = 150;
            Position.Width = 658;
            Position.Height = 206;

            //Start a new level to scroll in the background
            level = new Level(1);
            level.GenerateLevel(level.current_level);
            AudioManager.QueueSound("music", true);
        }
Пример #2
0
        public MenuExample(Game game)
        {
            //Create a dictionary <string, ImageButton.Callback> With the name of the image in contents

              //Images must be a pair of images and the second one named the same as the first with Hover appended

            Dictionary<string, ImageButton.Callback> NameMethods = new Dictionary<string, ImageButton.Callback>();

            // The Q and Start is the name of the PUBLIC method to call when clicked
            NameMethods.Add("QuitButton", Q);
            NameMethods.Add("StartButton", Start);

            MainMenu = new Menu(game, NameMethods, HLayout.Left, VLayout.Bottom, new Vector2(50, 50), 40);
        }
Пример #3
0
        ScreenText st; //used to display PAUSE while paused

        #endregion Fields

        #region Constructors

        public GameplayState(Game game)
            : base(game)
        {
            Game1 g = (Game1)game;

            input = ContentStorageManager.Get<InputController>("input");

            st = new ScreenText("Courier", "PAUSE", new Vector2(2, 2), new Vector2(300, 300));//initialize the PAUSE text

            //Create and set pause buttons
            Dictionary<string, ImageButton.Callback> menuButtons = new Dictionary<string, ImageButton.Callback>();
            menuButtons.Add("PauseResume", resumeButton);
            menuButtons.Add("MainMenuQuit", quitButton);

            //initialize menu
            pauseMenu = new Menu(g, menuButtons, HLayout.Center, VLayout.Bottom, new Vector2(300, 300), 10);

            player = new ControllableShip(new Vector2(Game1.ScreenSize.X / 2, Game1.ScreenSize.Y / 2), new Vector2(10, 10));
            parasite = new Parasite(player.Position, new Vector2(8,8));
            parasite.controlShip = player;
            level = new Level(1);
            // this method (level.Generate()) will be called when the level is needed to change. For now, its here.
            level.GenerateLevel(level.current_level);
        }