Example #1
0
    public void SpawnNext()
    {
        //Game Over if can't spawn piece
        if (Playfield.IsBlockAbovePlayZone())
        {
            Playfield.deleteAll();
            Timer.Instance.Stop();
            Transitioner.GameOver();
            Debug.Log("Game Over - Game Manager");
        }
        else
        {
            //Instantiates the Next Piece to spawn
            FallingPiece = Instantiate(NextPieces[0].PiecePrefab,
                                       transform.position,
                                       Quaternion.identity);
            PieceNumber = NextPieces[0].PieceNumber;
            NextPieces.RemoveAt(0);
            NextPieces.Add(ChooseRandomPiece());

            NextPiecesUI[0].ChangeDisplayPiece(NextPieces[0].PieceNumber);
            NextPiecesUI[1].ChangeDisplayPiece(NextPieces[1].PieceNumber);
            NextPiecesUI[2].ChangeDisplayPiece(NextPieces[2].PieceNumber);
            NextPiecesUI[3].ChangeDisplayPiece(NextPieces[3].PieceNumber);

            StorageLocked = false;
        }
    }