コード例 #1
0
 public KeyboardControls(Keys lMov = Keys.Left, Keys rMov = Keys.Right, Keys lRot = Keys.Z, Keys rRot = Keys.X, Keys hold = Keys.C, Keys softDrop = Keys.Down, Keys hardDrop = Keys.Space, float delayedAutoShift = 133, float autoRepeatRate = 5) : base()
 {
     LMove.AddKeyboardKey(lMov);
     RMove.AddKeyboardKey(rMov);
     LRotate.AddKeyboardKey(lRot);
     RRotate.AddKeyboardKey(rRot);
     Hold.AddKeyboardKey(hold);
     SoftDrop.AddKeyboardKey(softDrop);
     HardDrop.AddKeyboardKey(hardDrop);
     LMove.SetRepeat(delayedAutoShift / 1000, autoRepeatRate / 1000);
     RMove.SetRepeat(delayedAutoShift / 1000, autoRepeatRate / 1000);
 }
コード例 #2
0
ファイル: Grid.cs プロジェクト: magicpine/Tetris
        /// <summary>
        /// Drops the Current Falling Block to the Bottom
        /// </summary>
        private void DropBlockToTheBottom()
        {
            //Keeps track of the number of lines it moved, for scoring purposes
            int numberOfLinesItHadToMove = 0;

            do
            {
                MoveFallingBlock();
                numberOfLinesItHadToMove++;
            } while (BlockThatsFalling.IsItFalling);
            HardDrop?.Invoke(numberOfLinesItHadToMove);
        }