コード例 #1
0
 protected override void Update()
 {
     if (RawKeyboardInput.IsPressed(Keys.Space))
     {
         playRandomSong();
     }
     else if (RawKeyboardInput.IsPressed(Keys.R))
     {
         restartSong();
     }
     else if (RawKeyboardInput.IsPressed(Keys.Up))
     {
         playPreviousAlbum();
     }
     else if (RawKeyboardInput.IsPressed(Keys.Down))
     {
         playNextAlbum();
     }
     else if (RawKeyboardInput.IsPressed(Keys.Left))
     {
         playPreviousSong();
     }
     else if (RawKeyboardInput.IsPressed(Keys.Right))
     {
         playNextSong();
     }
 }
コード例 #2
0
 protected override void Update()
 {
     if (RawKeyboardInput.IsPressed(LeftBumpKey))
     {
         current -= RawKeyboardInput.IsHeld(Keys.LeftShift, Keys.RightShift) ? bumpPercentage * .5f : bumpPercentage;
         OnAdjustControl(MathHelper.Lerp(Min, Max, current));
     }
     else if (RawKeyboardInput.IsPressed(RightBumpKey))
     {
         current += RawKeyboardInput.IsHeld(Keys.LeftShift, Keys.RightShift) ? bumpPercentage * .5f : bumpPercentage;
         OnAdjustControl(MathHelper.Lerp(Min, Max, current));
     }
 }
コード例 #3
0
        protected override void Update()
        {
            for (int v = 0; v < 8; v++)
            {
                if (RawKeyboardInput.IsPressed(numRowKeys[v], numPadKeys[v]))
                {
                    bool isMuted = enabledVoices[v].DrawEnabled;

                    Music.SetVoiceMute(v, isMuted);

                    enabledVoices[v].DrawEnabled = !isMuted;
                }
            }
        }
コード例 #4
0
ファイル: PGNConsole.cs プロジェクト: jeffdt/padlock
        public override void Update()
        {
            base.Update();

            if (RawKeyboardInput.IsPressed(Keys.OemTilde))
            {
                IsDisplaying = !IsDisplaying;
            }

            if (!IsDisplaying)
            {
                return;
            }

            handleKeyboardInput();
        }
コード例 #5
0
ファイル: SimpleController.cs プロジェクト: jeffdt/BlueSun
        private void updateBumpControl()
        {
            if (RawKeyboardInput.IsPressed(Keys.Left, Keys.A))
            {
                Object.LocalPosition = Object.LocalPosition.PlusX(-1);
            }
            else if (RawKeyboardInput.IsPressed(Keys.Right, Keys.D))
            {
                Object.LocalPosition = Object.LocalPosition.PlusX(1);
            }

            if (RawKeyboardInput.IsPressed(Keys.Up, Keys.W))
            {
                Object.LocalPosition = Object.LocalPosition.PlusY(-1);
            }
            else if (RawKeyboardInput.IsPressed(Keys.Down, Keys.S))
            {
                Object.LocalPosition = Object.LocalPosition.PlusY(1);
            }
        }
コード例 #6
0
ファイル: PlayerController.cs プロジェクト: jeffdt/BlueSun
        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);
            }
        }