public void Initialize(BlockInstanceManager instanceManager, TetrominoData data) { this.instanceManager = instanceManager; this.data = data; InitPositions(); InitBlocks(instanceManager); }
/// <summary> /// /// </summary> /// <param name="tetrominoData"></param> /// <param name="testNum"></param> /// <param name="fromTo"> </param> /// <returns></returns> public static Vector2Int GetData(TetrominoData tetrominoData, int testNum, FromToRotation fromTo) { testNum = Mathf.Max(testNum, 0); testNum = Mathf.Min(testNum, maxRotationTestNum); Vector2Int test; switch (tetrominoData.tetrominoType) { case TetrominoType.General: test = GeneralWallKickData[(int)fromTo, testNum]; break; case TetrominoType.lowerLmino: test = ITetrominoWallKickData[(int)fromTo, testNum]; break; case TetrominoType.Omino: test = Vector2Int.zero; break; default: throw new System.InvalidOperationException($"fromTo:{System.Enum.GetName(typeof(FromToRotation), fromTo)} not supported"); } return(test); }
void InitFollowingTetrominos() { var numFollowingTetrominos = Mathf.Max(1, levelManager.FollowingTetrominoCount); if (followingTetrominos.Count > 0) { for (var i = 0; i < followingTetrominos.Count; i++) { var t = followingTetrominos[i]; t.RemoveAllBlocks(); } followingTetrominos.Clear(); } for (var i = 0; i < numFollowingTetrominos; i++) { TetrominoData data = GetNextTetrominoData(); var t = new Tetromino(blockInstanceManager, data); t.SetLiarTetrisMode(stateManager != null && stateManager.CurrentState.Value == GameState.LiarTetrisMode); followingTetrominos.Add(t); } UpdateFollowingTetrominosPositions(); }
public void Initialize(Block[] blocks, TetrominoData data) { this.data = data; InitPositions(); InitBlocks(blocks); }
public Tetromino(Block[] blocks, TetrominoData data) { Initialize(blocks, data); }
public Tetromino(BlockInstanceManager instanceManager, TetrominoData data) { Initialize(instanceManager, data); }