Пример #1
0
    public void NextBlock()
    {
        if (gameOver)
        {
            return;
        }

        currentBlock = m_spawner.NextBlock();

        // check game over
        if (!currentBlock.MoveDown())
        {
            foreach (Transform child in currentBlock.transform)
            {
                var x = EX.Float2Int(child.transform.position.x);
                var y = EX.Float2Int(child.transform.position.y);

                if (Grid[x, y] != null)
                {
                    OnGameOver?.Invoke();
                    gameOver     = true;
                    currentBlock = null;
                    return;
                }
            }
        }

        InitPreview();

        UpdatePreview();

        m_spawner.UpdateNextChainSlot();

        holdedThisTurn = false;

        landedWithRotate = false;

        isTSpin = false;
    }