Esempio n. 1
0
    public void ClearBlock()
    {
        blocksCleared++;
        score += distScore;
        uILogic.ChangeScore(score);

        // decide difficulty
        Difficulty level;
        double     ratio = coinsCollected / (double)blocksCleared;

        if (ratio > 9)
        {
            level = Difficulty.HARD;
        }
        else if (ratio > 7)
        {
            level = Difficulty.MED;
        }
        else
        {
            level = Difficulty.EASY;
        }

        // start pipeline to create new block
        (PathPrefab prefab, PathPrefab prev) = pathGenerator.AddPathBlock();
        obstacleGenerator.nextObstacles(prefab, prev, level);
        coinGenerator.nextCoins(prefab, prev, level);
    }