private void Start()
 {
     if (instance != null)
     {
         if (instance != this)
         {
             Destroy(gameObject);
         }
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         instance = this;
     }
 }
Exemple #2
0
    private void Start()
    {
        instance = this;
        if (randomOnStart)
        {
            for (int i = 0; i < BaseColorCount; i++)
            {
                Colors[i] = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f));

                float heightval;
                if (i == 0)
                {
                    heightval = Random.Range(0, 0.05f);
                }
                else
                {
                    heightval = Random.Range(0f, (float)1 / BaseColorCount) + ((float)i / BaseColorCount) / 1.5f;
                }

                Heights[i]     = heightval;
                BlendLevels[i] = Random.Range(0.1f, 0.7f);
            }
        }

        if (usePalette)
        {
            if (ColorPalettePersistance.instance != null)
            {
                ColorPalettePersistance col = FindObjectOfType <ColorPalettePersistance>();
                for (int i = 0; i < BaseColorCount; i++)
                {
                    Colors[i] = col.CurrentColorPalette.Colors[i];
                }
            }
        }
    }
Exemple #3
0
 private void Awake()
 {
     colorPalettePersistance = FindObjectOfType <ColorPalettePersistance>();
     musicPlayer             = FindObjectOfType <MusicPlayer>();
 }