Как сделать чтобы при нажатии на кнопку в игре на Monogame открывалась новая сцена?

Как сделать чтобы при нажатии на кнопку в игре на Monogame открывалась новая сцена? В проекте есть основная комната - Room. В левом углу находится кнопка, как сделать чтобы я при нажатии на нее перешел в полностью новую сцену, где будут свои кнопки и тд? Ниже представлен код кнопки, а под ним код основной комнаты и вообще игры

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace Tire_Fitting_Simulator
{
    public class ButtonToGarage
    {
        private readonly Texture2D texture;
        private Vector2 position;
        private readonly Rectangle rectangle;
        private Color shade = Color.White;
        private MouseState lastMouseState;

        public ButtonToGarage(Texture2D texture, Vector2 position)
        {
            this.texture = texture;
            this.position = position;
            rectangle = new ((int)position.X, (int)position.Y, texture.Width, texture.Height);
        }

        public void Update()
        {
            MouseState mouseState = Mouse.GetState();
            Rectangle cursor  = new (mouseState.Position.X, mouseState.Position.Y, 1,1);
            if (cursor.Intersects(rectangle))
                shade = Color.DarkGray;
            else 
                shade = Color.White;

        }
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, position,shade);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace Tire_Fitting_Simulator
{
    public class Game1 : Game
    {
        ButtonToGarage button;
        Container cont;
        Player player;
        Texture2D room;
        Texture2D mainMenu;
        Vector2 mainMenuPosition;
        private GraphicsDeviceManager _graphics;
        private SpriteBatch spriteBatch;
        GameState gameState = GameState.Menu;
        Vector2 playerPosition;
        float playerSpeed;

        MenuOptions option = MenuOptions.New;
        int optionsCounter = 1;
        int OptionsCounter
        {
            get { return optionsCounter; }
            set
            {
                if (value > 3)
                    optionsCounter = 3;
                if (value < 1)
                    optionsCounter = 1;
                if (optionsCounter == 1)
                    option = MenuOptions.New;
                else if (optionsCounter == 2)
                    option = MenuOptions.Resume;
                else
                    option = MenuOptions.Exit;
            }
        }
        KeyboardState crrKS;
        KeyboardState preKS;
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IsMouseVisible = true;
        }

        protected override void Initialize()
        {
            base.Initialize();
            _graphics.IsFullScreen = false;
            _graphics.PreferredBackBufferWidth = 1920;
            _graphics.PreferredBackBufferHeight = 1080;
            _graphics.ApplyChanges();
            cont = new Container(new Line(5, _graphics.PreferredBackBufferWidth-5), 
                new Line (5, _graphics.PreferredBackBufferHeight-5));

            playerPosition = new Vector2(_graphics.PreferredBackBufferWidth / 2, _graphics.PreferredBackBufferHeight / 2);
            playerSpeed = 100f;

            mainMenuPosition = new Vector2(_graphics.PreferredBackBufferWidth/2,
                _graphics.PreferredBackBufferHeight/2);
            mainMenu = Content.Load<Texture2D>("BackgroundMenu");
            room = Content.Load<Texture2D>("Room");
            player = new Player(Content.Load<Texture2D>("personage"), new Rectangle(1350, 500,555, 555));
            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            button = new(Content.Load<Texture2D>("GarageButton"), new(0, 0));

        }

        protected override void Update(GameTime gameTime)
        {
            button.Update();
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            crrKS = Keyboard.GetState();
            preKS = crrKS;
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
             spriteBatch.Begin();
            spriteBatch.Draw(
                mainMenu,
                mainMenuPosition,
                null,
                Color.White,
                0f,
                new Vector2(mainMenu.Width / 2, mainMenu.Height / 2),
                Vector2.One,
                SpriteEffects.None,
                0f);
            spriteBatch.Draw(room,new Vector2(0,0), Color.White);
            player.Draw(gameTime, spriteBatch);
            button.Draw(spriteBatch);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}

Ответы (0 шт):