Пример #1
0
        private void SetGlowGridFromDist(int index)
        {
            float    num      = (float)calcGrid[index].intDist / 100f;
            ColorInt colorInt = default(ColorInt);

            if (num <= glower.Props.glowRadius)
            {
                float b  = 1f / (num * num);
                float b2 = Mathf.Lerp(1f + attenLinearSlope * num, b, 0.4f);
                colorInt   = glower.Props.glowColor * b2;
                colorInt.a = 0;
            }
            if (colorInt.r > 0 || colorInt.g > 0 || colorInt.b > 0)
            {
                colorInt.ClampToNonNegative();
                ColorInt colorInt2 = glowGrid[index].AsColorInt();
                colorInt2 += colorInt;
                if (num < glower.Props.overlightRadius)
                {
                    colorInt2.a = 1;
                }
                Color32 toColor = colorInt2.ToColor32;
                glowGrid[index] = toColor;
            }
        }
Пример #2
0
        private void SetGlowGridFromDist(int index)
        {
            float    num  = (float)this.calcGrid[index].intDist / 100f;
            ColorInt colB = default(ColorInt);

            if (num <= this.glower.Props.glowRadius)
            {
                float b  = 1f / (num * num);
                float a  = 1f + this.attenLinearSlope * num;
                float b2 = Mathf.Lerp(a, b, 0.4f);
                colB = this.glower.Props.glowColor * b2;
            }
            if (colB.r > 0 || colB.g > 0 || colB.b > 0)
            {
                colB.ClampToNonNegative();
                ColorInt colA = this.glowGrid[index].AsColorInt();
                colA += colB;
                if (num < this.glower.Props.overlightRadius)
                {
                    colA.a = 1;
                }
                Color32 toColor = colA.ToColor32;
                this.glowGrid[index] = toColor;
            }
        }