public void Test_Drop_Shape() { blockShape.DropShape(); for (int i = 0; i < 4; i++) { Assert.AreEqual(4, blockShape.ShapeBlocks[i].GridY); } }
public void Test_Drop_Shape() { blockShape.DropShape(); Assert.AreEqual(4, blockShape.ShapeBlocks[0].GridY); Assert.AreEqual(4, blockShape.ShapeBlocks[1].GridY); Assert.AreEqual(3, blockShape.ShapeBlocks[2].GridY); Assert.AreEqual(3, blockShape.ShapeBlocks[3].GridY); }
/// <summary> /// Method <c>KeyDown_Event(object sender, KeyEventArgs e)</c> /// A method that represents the controls for tetris. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void KeyDown_Event(object sender, KeyEventArgs e) { if (e.Key == Key.Down) { _shape.MoveDown(); } if (e.Key == Key.Left) { _shape.MoveLeft(); } if (e.Key == Key.Right) { _shape.MoveRight(); } if (e.Key == Key.Up) { _shape.Rotate(true); } if (e.Key == Key.Space) { _shape.DropShape(); } if (e.Key == Key.I) { string gridString = ""; for (int i = 0; i < GameBoard.Grid.GetLength(0); i++) { for (int j = 0; j < GameBoard.Grid.GetLength(1); j++) { gridString += GameBoard.Grid[i, j] + " "; } gridString += Environment.NewLine; } MessageBox.Show(gridString.ToString()); } if (e.Key == Key.R) { RestartGame(); } if (e.Key == Key.P) { Pause(); } if (e.Key == Key.H) { HoldBlock(); } }