예제 #1
0
    private bool videoAdChecker    = false; // Is a video ad being played

    #endregion


    // Initialize managers, colors, and start procedural generation
    void Start()
    {
        colors    = new Color[2];
        colors[0] = PlayerData.GetColor1();
        colors[1] = PlayerData.GetColor2();

        _ColorCheck();                                                                        // Assert that there are enough colors in the game
        _FindObjects();                                                                       // Find player and managers

        _UpdateMaterialColors();                                                              // Handle color changing of materials
        pg.SetMaterials(materials);                                                           // Set materials in Procedural Generator
        _SetAlphaColors();                                                                    // Establish an array of transparent colors for changing materials
        materials[currIndex].SetColor("_BaseColor", colorsAlpha[currIndex]);                  // Set starting material to be transparent

        _SetStartingProceduralVariables();                                                    // Alter procedural values to prepare for first procedural generation
        pg.GenerateChunk(currStartZ, currEndZ, currStep, currFrequency, maxConsecutiveColor); // First procedural generation chunk

        SkyboxManager.UpdateSkybox();

        if (adsController.DistanceSinceAdChecker())      // Has the player gone far enough to trigger a video ad
        {
            PlayerPrefsController.SetDistanceSinceAd(0); // Reset the distance counter
            adsController.ShowVideoAd();
        }
    }