コード例 #1
0
 void TryRotate(MovableGrid rotated)
 {
     MovableGrid[] moves = { rotated,
                             rotated.MoveLeft(),
                             rotated.MoveRight(),
                             rotated.MoveLeft().MoveLeft(),
                             rotated.MoveRight().MoveRight(), };
     foreach (MovableGrid test in moves)
     {
         if (!(OutsideBoard(test) || HitAnotherBlock(test)))
         {
             fallingBlock = test;
             return;
         }
     }
 }
コード例 #2
0
ファイル: Board.cs プロジェクト: kotchwane/Tetris-C-Sharp
 public void MoveLeft()
 {
     if (!IsFallingBlock())
     {
         return;
     }
     TryMove(fallingBlock.MoveLeft());
 }
コード例 #3
0
ファイル: Board.cs プロジェクト: kotchwane/Tetris-C-Sharp
 void TryRotate(MovableGrid rotated)
 {
     MovableGrid[] moves =
     {
         rotated,
         rotated.MoveLeft(), // wallkick moves
         rotated.MoveRight(),
         rotated.MoveLeft().MoveLeft(),
         rotated.MoveRight().MoveRight(),
     };
     foreach (MovableGrid test in moves)
     {
         if (!ConflictsWithBoard(test))
         {
             fallingBlock = test;
             return;
         }
     }
 }
コード例 #4
0
 private void TryRotate(MovableGrid test)
 {
     MovableGrid[] moves =
     {
         test,
         test.MoveLeft(),
         test.MoveRight(),
         test.MoveLeft().MoveLeft(),
         test.MoveRight().MoveRight()
     };
     foreach (MovableGrid move in moves)
     {
         if (!ConflictWithBoard(move))
         {
             fallingBlock = move;
             return;
         }
     }
 }
コード例 #5
0
 private void TryRotate(MovableGrid rotated)
 {
     MovableGrid[] moves =
     {
         rotated,
         rotated.MoveLeft(),     // wallkick moves
         rotated.MoveRight(),
         rotated.MoveLeft().MoveLeft(),
         rotated.MoveRight().MoveRight(),
     };
     refreshTab(movingGrid, null);
     foreach (MovableGrid test in moves)
     {
         if (!ConflictsWithBoard(test))
         {
             refreshTab(null, test);
             movingGrid = test;
             return;
         }
     }
     refreshTab(null, movingGrid);
 }
コード例 #6
0
        public void MoveLeft()
        {
            MovableGrid test = movingGrid.MoveLeft();

            refreshTab(movingGrid, null);
            if (!ConflictsWithBoard(test))
            {
                refreshTab(null, test);
                movingGrid = test;
            }
            else
            {
                refreshTab(null, movingGrid);
            }
        }