Esempio n. 1
0
 public void Initialize(BlockInstanceManager instanceManager, TetrominoData data)
 {
     this.instanceManager = instanceManager;
     this.data            = data;
     InitPositions();
     InitBlocks(instanceManager);
 }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 public void Initialize(Block[] blocks, TetrominoData data)
 {
     this.data = data;
     InitPositions();
     InitBlocks(blocks);
 }
Esempio n. 5
0
 public Tetromino(Block[] blocks, TetrominoData data)
 {
     Initialize(blocks, data);
 }
Esempio n. 6
0
 public Tetromino(BlockInstanceManager instanceManager, TetrominoData data)
 {
     Initialize(instanceManager, data);
 }