Esempio n. 1
0
    public SsColorRef[]                             Colors;             // [0]:left top(or whole color) [1]:right top [2]:left bottom [3]:right bottom

    public SsColorBlendKeyValue(int colorsNum)
    {
        Target    = SsColorBlendTarget.None;
        Operation = SsColorBlendOperation.Mix;
        if (colorsNum > 0)
        {
            Colors = SsColorRef.CreateArray(colorsNum);
        }
    }
Esempio n. 2
0
    public SsInterpolatable Interpolate(SsCurveParams curve, float time, SsInterpolatable start_, SsInterpolatable end_, int startTime, int endTime)
    {
        var start = (SsColorBlendKeyValue)start_;
        var end   = (SsColorBlendKeyValue)end_;

        if (start.Target == SsColorBlendTarget.None &&
            end.Target == SsColorBlendTarget.None)
        {
#if false // obsolete
            // act as nothing blending when the targets of both keys are none.
            for (int i = 0; i < Colors.Length; ++i)
            {
                Colors[i].R = Colors[i].G = Colors[i].B = Colors[i].A = 0;
            }
            this.Target    = SsColorBlendTarget.None;
            this.Operation = SsColorBlendOperation.Non;
#else
            // not needs to interpolate, just refers to start key.
            Debug.LogError("Must not come here.");
#endif
        }
        else
        {
            for (int i = 0; i < Colors.Length; ++i)
            {
                Colors[i].Interpolate(curve, time, start.Colors[i], end.Colors[i], startTime, endTime);
            }
            bool useStartParam = time < 1 ? true : false;
            if (start.Target == SsColorBlendTarget.None)
            {
                // use the end key colors when the target of start key is none
                for (int i = 0; i < Colors.Length; ++i)
                {
                    Colors[i].R = end.Colors[i].R;
                    Colors[i].G = end.Colors[i].G;
                    Colors[i].B = end.Colors[i].B;
                }
                useStartParam = false;
            }
            else
            if (end.Target == SsColorBlendTarget.None)
            {
                // use the start key colors when the target of end key is none
                for (int i = 0; i < Colors.Length; ++i)
                {
                    Colors[i].R = start.Colors[i].R;
                    Colors[i].G = start.Colors[i].G;
                    Colors[i].B = start.Colors[i].B;
                }
            }
            // inherit target and operation
            if (useStartParam)
            {
                this.Target    = start.Target;
                this.Operation = start.Operation;
            }
            else
            {
                this.Target    = end.Target;
                this.Operation = end.Operation;
            }
        }
        return(this);
    }
Esempio n. 3
0
 public SsColorBlendKeyValue(SsColorBlendKeyValue r)
 {
     Target    = r.Target;
     Operation = r.Operation;
     Colors    = (SsColorRef[])r.Colors.Clone();
 }