Beispiel #1
0
        protected override void Update(GameTime gameTime)
        {
            if (nextWorld != null && World != nextWorld)
            {
                swapWorld();
            }

            IsInFocus = IsActive;

            InputManager.Update();
            RawKeyboardInput.Update();
            RawGamepadInput.Update();
            MouseReader.Update();

            Time.Set(gameTime);

            base.Update(gameTime);

            Console.Update();

            if (!Console.IsDisplaying && !PauseWorld)
            {
                UpdateGameplay();
            }

            Renderer.Update();
        }
Beispiel #2
0
 protected override void Update()
 {
     if (RawGamepadInput.IsHeld(Button))
     {
         spriteRenderer.Enabled = true;
     }
     else
     {
         spriteRenderer.Enabled = false;
     }
 }
Beispiel #3
0
        protected override void Initialize()
        {
            base.Initialize();

            MouseReader.Initialize();
            RawKeyboardInput.Initialize();
            RawGamepadInput.Initialize();
            GameSpeed.Reinitialize();
            GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
            DebugHelper.Initialize();

            MouseVisible = StartMouseVisible;

            InitializeGame();
        }
Beispiel #4
0
        protected override void Update()
        {
            AxisDirections?moveDirection = null;

            if (RawKeyboardInput.IsPressed(Keys.W) || RawGamepadInput.IsDpadPressed(AxisDirections.Up) || RawGamepadInput.IsLeftJoystickPressed(AxisDirections.Up))
            {
                moveDirection = AxisDirections.Up;
            }
            else if (RawKeyboardInput.IsPressed(Keys.D) || RawGamepadInput.IsDpadPressed(AxisDirections.Right) || RawGamepadInput.IsLeftJoystickPressed(AxisDirections.Right))
            {
                moveDirection = AxisDirections.Right;
            }
            else if (RawKeyboardInput.IsPressed(Keys.S) || RawGamepadInput.IsDpadPressed(AxisDirections.Down) || RawGamepadInput.IsLeftJoystickPressed(AxisDirections.Down))
            {
                moveDirection = AxisDirections.Down;
            }
            else if (RawKeyboardInput.IsPressed(Keys.A) || RawGamepadInput.IsDpadPressed(AxisDirections.Left) || RawGamepadInput.IsLeftJoystickPressed(AxisDirections.Left))
            {
                moveDirection = AxisDirections.Left;
            }

            if (moveDirection != null)
            {
                Point destination = coords + ((AxisDirections)moveDirection).ToPoint();

                if (checkCanMove(destination))
                {
                    GameGrid[coords.X, coords.Y]           = null;
                    GameGrid[destination.X, destination.Y] = Object;
                    coords = destination;
                }
            }


            Diagonals?diagonalDir = null;

            if (RawKeyboardInput.IsPressed(Keys.Q))
            {
                diagonalDir = Diagonals.UpLeft;
            }
            else if (RawKeyboardInput.IsPressed(Keys.E))
            {
                diagonalDir = Diagonals.UpRight;
            }
            else if (RawKeyboardInput.IsPressed(Keys.Z))
            {
                diagonalDir = Diagonals.DownLeft;
            }
            else if (RawKeyboardInput.IsPressed(Keys.C))
            {
                diagonalDir = Diagonals.DownRight;
            }

            if (diagonalDir != null)
            {
                Sfx.PlaySfx("sfx1");
                GameObject projectileObj = ProjectileController.BuildObject(PROJ_SPEED, PROJ_SIZE, PROJ_BOUNCES, ((Diagonals)diagonalDir).ToVector2());
                projectileObj.LocalPosition = Object.LocalPosition.Plus(tileSize / 2 - 1);
                Pigeon.World.AddObj(projectileObj);
            }
        }