private void OnValidate()
    {
        if (validateTempToColor)
        {
            if (temperature != temperatureValidate)
            {
                color = Starmap.GetColorFromTemperature(temperature);
            }

            if (tempGradPreview.colorKeys.Length <= 1 || temperature != temperatureValidate)
            {
                var gcks = new GradientColorKey[8];
                for (int i = 0; i < gcks.Length; i++)
                {
                    gcks[i].time  = i / (float)(gcks.Length - 1);
                    gcks[i].color = Starmap.GetColorFromTemperature(temperature * gcks[i].time);
                }
                tempGradPreview           = new Gradient();
                tempGradPreview.colorKeys = gcks;
            }

            temperatureValidate = temperature;
        }
    }
Exemplo n.º 2
0
 void Update()
 {
     camera.backgroundColor = Starmap.GetColorFromTemperature(temperature);
 }