-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomTetrimino.cs
45 lines (41 loc) · 1.37 KB
/
CustomTetrimino.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MineTris {
public class CustomTetrimino {
/// <summary>
/// The blocks that belong to the Tetrimino.
/// </summary>
public List<TetrisBlock> blocks;
/// <summary>
/// Moves the Tetrimino down by one block.
/// </summary>
public void MoveDown () {
foreach (TetrisBlock block in blocks) {
block.MoveDown ();
}
}
/// <summary>
/// Adds all the tetris blocks that belong to this tetrimio to a matrix.
/// </summary>
/// <param name="matrix">The matrix.</param>
public void AddTetrisBlocksToMatrix (TetrisBlock[,] matrix) {
foreach (TetrisBlock block in blocks) {
matrix[block.X, block.Y] = block;
}
}
/// <summary>
/// Creates a new custom tetrimino.
/// </summary>
/// <param name="blocks">What block(s) does the tetrimino has initially.</param>
/// <param name="matrix"></param>
public CustomTetrimino (List<TetrisBlock> blocks, TetrisBlock[,] matrix) {
this.blocks = blocks;
foreach (TetrisBlock block in blocks) {
matrix[block.X, block.Y] = null;
}
}
}
}