Beispiel #1
0
    public void SpawnRandomEvent()
    {
        int id = Random.Range(0, 5);

        if (id == 0)
        {
            nextPieceHider.SetActive(false);
            GridBase.scoreMultiplier = 1;

            SetCurrentRandomEvent("Speed change!");
            GridBase.fallTime = Random.Range(0.4f, 1f);

            Debug.Log("Fall speed changed to: " + GridBase.fallTime);
        }
        else if (id == 1)
        {
            nextPieceHider.SetActive(true);
            GridBase.scoreMultiplier = 1;

            SetCurrentRandomEvent("Piece hidden!");
        }
        else if (id == 2)
        {
            nextPieceHider.SetActive(false);
            GridBase.scoreMultiplier = 1;

            SetCurrentRandomEvent("Lines out!");

            for (int i = 2; i >= 0; i--)
            {
                GridBase.DeleteLine(i);
                GridBase.RowDown(i);
            }
        }
        else if (id == 3)
        {
            nextPieceHider.SetActive(false);

            SetCurrentRandomEvent("Double score!");

            GridBase.scoreMultiplier = 2;
        }
        else
        {
            SetCurrentRandomEvent("None");
        }
    }