protected override void Initialize()
        {
            this.stateManager = new StateManager(this.Content, this.graphics);
            this.inputHandler = new InputHandler();

            base.Initialize();
        }
Пример #2
0
 public GameState(ContentManager content, GraphicsDeviceManager graphics, StateManager stateManager)
 {
     this.StateManager = stateManager;
     base.Content = content;
     this.levelManager = new LevelManager();
     this.Graphics = graphics;
     Initialize();
 }
        public void CheckForMouseInput(StateManager stateManager)
        {
            MouseState newMouseState = Mouse.GetState();

            //if (newMouseState.X < 500
            //    && this.oldMouseState.LeftButton == ButtonState.Pressed
            //    && newMouseState.LeftButton == ButtonState.Released)
            //{
            //    stateManager.CurrentState = new GameState(stateManager.Content, stateManager.Graphics);

            //}
            this.oldMouseState = newMouseState;
        }
        public void CheckForKeyboardInput(StateManager stateManager)
        {
            /*if (Keyboard.GetState().IsKeyDown(Keys.F))
            {
                this.graphics.ToggleFullScreen();
                this.graphics.ApplyChanges();
            }*/
            this.isRunning = true;

            if (Keyboard.GetState().IsKeyDown(Keys.P) &&
                stateManager.CurrentState is MenuState)
            {
                stateManager.CurrentState = new GameState(stateManager.Content, stateManager.Graphics, stateManager);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.isRunning = false;
            }
        }