|
| 1 | +using System.Collections.Generic; |
| 2 | +using UnityEngine; |
| 3 | + |
| 4 | +public static class Data |
| 5 | +{ |
| 6 | + public static readonly float cos = Mathf.Cos(Mathf.PI / 2f); |
| 7 | + public static readonly float sin = Mathf.Sin(Mathf.PI / 2f); |
| 8 | + public static readonly float[] RotationMatrix = new float[] { cos, sin, -sin, cos }; |
| 9 | + |
| 10 | + public static readonly Dictionary<Tetromino, Vector2Int[]> Cells = new Dictionary<Tetromino, Vector2Int[]>() |
| 11 | + { |
| 12 | + { Tetromino.I, new Vector2Int[] { new Vector2Int(-1, 1), new Vector2Int( 0, 1), new Vector2Int( 1, 1), new Vector2Int( 2, 1) } }, |
| 13 | + { Tetromino.J, new Vector2Int[] { new Vector2Int(-1, 1), new Vector2Int(-1, 0), new Vector2Int( 0, 0), new Vector2Int( 1, 0) } }, |
| 14 | + { Tetromino.L, new Vector2Int[] { new Vector2Int( 1, 1), new Vector2Int(-1, 0), new Vector2Int( 0, 0), new Vector2Int( 1, 0) } }, |
| 15 | + { Tetromino.O, new Vector2Int[] { new Vector2Int( 0, 1), new Vector2Int( 1, 1), new Vector2Int( 0, 0), new Vector2Int( 1, 0) } }, |
| 16 | + { Tetromino.S, new Vector2Int[] { new Vector2Int( 0, 1), new Vector2Int( 1, 1), new Vector2Int(-1, 0), new Vector2Int( 0, 0) } }, |
| 17 | + { Tetromino.T, new Vector2Int[] { new Vector2Int( 0, 1), new Vector2Int(-1, 0), new Vector2Int( 0, 0), new Vector2Int( 1, 0) } }, |
| 18 | + { Tetromino.Z, new Vector2Int[] { new Vector2Int(-1, 1), new Vector2Int( 0, 1), new Vector2Int( 0, 0), new Vector2Int( 1, 0) } }, |
| 19 | + }; |
| 20 | + |
| 21 | + private static readonly Vector2Int[,] WallKicksI = new Vector2Int[,] { |
| 22 | + { new Vector2Int(0, 0), new Vector2Int(-2, 0), new Vector2Int( 1, 0), new Vector2Int(-2,-1), new Vector2Int( 1, 2) }, |
| 23 | + { new Vector2Int(0, 0), new Vector2Int( 2, 0), new Vector2Int(-1, 0), new Vector2Int( 2, 1), new Vector2Int(-1,-2) }, |
| 24 | + { new Vector2Int(0, 0), new Vector2Int(-1, 0), new Vector2Int( 2, 0), new Vector2Int(-1, 2), new Vector2Int( 2,-1) }, |
| 25 | + { new Vector2Int(0, 0), new Vector2Int( 1, 0), new Vector2Int(-2, 0), new Vector2Int( 1,-2), new Vector2Int(-2, 1) }, |
| 26 | + { new Vector2Int(0, 0), new Vector2Int( 2, 0), new Vector2Int(-1, 0), new Vector2Int( 2, 1), new Vector2Int(-1,-2) }, |
| 27 | + { new Vector2Int(0, 0), new Vector2Int(-2, 0), new Vector2Int( 1, 0), new Vector2Int(-2,-1), new Vector2Int( 1, 2) }, |
| 28 | + { new Vector2Int(0, 0), new Vector2Int( 1, 0), new Vector2Int(-2, 0), new Vector2Int( 1,-2), new Vector2Int(-2, 1) }, |
| 29 | + { new Vector2Int(0, 0), new Vector2Int(-1, 0), new Vector2Int( 2, 0), new Vector2Int(-1, 2), new Vector2Int( 2,-1) }, |
| 30 | + }; |
| 31 | + |
| 32 | + private static readonly Vector2Int[,] WallKicksJLOSTZ = new Vector2Int[,] { |
| 33 | + { new Vector2Int(0, 0), new Vector2Int(-1, 0), new Vector2Int(-1, 1), new Vector2Int(0,-2), new Vector2Int(-1,-2) }, |
| 34 | + { new Vector2Int(0, 0), new Vector2Int( 1, 0), new Vector2Int( 1,-1), new Vector2Int(0, 2), new Vector2Int( 1, 2) }, |
| 35 | + { new Vector2Int(0, 0), new Vector2Int( 1, 0), new Vector2Int( 1,-1), new Vector2Int(0, 2), new Vector2Int( 1, 2) }, |
| 36 | + { new Vector2Int(0, 0), new Vector2Int(-1, 0), new Vector2Int(-1, 1), new Vector2Int(0,-2), new Vector2Int(-1,-2) }, |
| 37 | + { new Vector2Int(0, 0), new Vector2Int( 1, 0), new Vector2Int( 1, 1), new Vector2Int(0,-2), new Vector2Int( 1,-2) }, |
| 38 | + { new Vector2Int(0, 0), new Vector2Int(-1, 0), new Vector2Int(-1,-1), new Vector2Int(0, 2), new Vector2Int(-1, 2) }, |
| 39 | + { new Vector2Int(0, 0), new Vector2Int(-1, 0), new Vector2Int(-1,-1), new Vector2Int(0, 2), new Vector2Int(-1, 2) }, |
| 40 | + { new Vector2Int(0, 0), new Vector2Int( 1, 0), new Vector2Int( 1, 1), new Vector2Int(0,-2), new Vector2Int( 1,-2) }, |
| 41 | + }; |
| 42 | + |
| 43 | + public static readonly Dictionary<Tetromino, Vector2Int[,]> WallKicks = new Dictionary<Tetromino, Vector2Int[,]>() |
| 44 | + { |
| 45 | + { Tetromino.I, WallKicksI }, |
| 46 | + { Tetromino.J, WallKicksJLOSTZ }, |
| 47 | + { Tetromino.L, WallKicksJLOSTZ }, |
| 48 | + { Tetromino.O, WallKicksJLOSTZ }, |
| 49 | + { Tetromino.S, WallKicksJLOSTZ }, |
| 50 | + { Tetromino.T, WallKicksJLOSTZ }, |
| 51 | + { Tetromino.Z, WallKicksJLOSTZ }, |
| 52 | + }; |
| 53 | + |
| 54 | +} |
0 commit comments