Exemple #1
0
    private GameObject GenerateBonusWorldChunk(float positionX, BaseChunkShape shape)
    {
        Debug.Log("new chunk at " + positionX);
        var eligibleChunkShapes = chunkShapes.Where(x => GameManager.Instance.distanceTraveled >= x.Difficulty - 1).ToList();

        var chunk = (GameObject)Instantiate(worldChunkPrefab, new Vector3(positionX, GameManager.Instance.Area == GameManager.Areas.Bonus ? 100 : 0, 0), new Quaternion(0, 0, 0, 0));

        if (shape == null)
        {
            shape = eligibleChunkShapes.RandomElement();
        }

        BaseBiome biome = new BonusBiome();

        chunkGenerator.Generate(chunk, shape, biome, false);
        coinGenerator.Generate(chunk, shape, biome, false);
        powerupGenerator.Generate(chunk, shape, biome, false);
        return(chunk);
    }