Example #1
0
    private void buildRandomLine(LevelObject l)
    {
        int rand         = Random.Range(0, 2);
        int randlength   = Random.Range(0, 8);
        int randobstacle = Random.Range(1, 3);

        for (int i = 0; i < randlength / randobstacle; i++)
        {
            switch (rand)
            {
            case 0:
                l.AddBottomBlockLine(randobstacle);
                break;

            case 1:
                l.AddMiddleBlockLine(randobstacle);
                break;

            case 2:
                l.AddTopBlockLine(randobstacle);
                break;
            }
            if (Random.Range(0, 15) > 10)
            {
                l.AddFloorBlockToLast(randobstacle);
            }
            l.AddRandomToLast();
        }
    }