Пример #1
0
        private void Parse(byte[] command)
        {
            int loopLength;

            for (int i = 0; i < command.Length; i++)
            {
                if (i == 0)
                {
                    Initiator = Convert.ToInt32((byte)command[i]);
                }
                else if (i == 1)
                {
                    CommandId = (CommandId)Enum.ToObject(typeof(CommandId), Convert.ToInt32((byte)command[i]));
                }
                else if (i == 2)
                {
                    Length = Convert.ToInt32((byte)command[i]);
                }
                else if (i == 3)
                {
                    ThermalShutDownValue = Convert.ToInt32((byte)command[i]);
                    break;
                }
            }

            if (Length == 32)
            {
                loopLength = 28;
            }
            else
            {
                loopLength = 8;
            }


            ChannelValues cv;

            for (int i = 4; i < loopLength; i++)
            {
                cv = new ChannelValues();
                if (i % 4 == 0)
                {
                    cv.ChannelId = (ChannelId)Enum.ToObject(typeof(ChannelId), Convert.ToInt32((byte)command[i]));
                }
                else if (i % 5 == 0)
                {
                    cv.CommandValue = Convert.ToInt32((byte)command[i]);
                }
                else if (i % 6 == 0)
                {
                    cv.DimmingValue = Convert.ToInt32((byte)command[i]);
                }
                else if (i % 7 == 0)
                {
                    cv.IndicatorValue = Convert.ToInt32((byte)command[i]);
                }

                ChannelValueList.Add(cv);
            }
        }
Пример #2
0
 public DecalState(float saturation, ChannelValues red, ChannelValues green, ChannelValues blue, ChannelValues alpha)
 {
     Saturation = saturation;
     Red        = red;
     Blue       = blue;
     Green      = green;
     Alpha      = alpha;
 }
Пример #3
0
 public static ChannelValues Lerp(ChannelValues a, ChannelValues b, ChannelCurves curves, float progress)
 {
     return(new ChannelValues(
                Mathf.Lerp(a.Threshold, b.Threshold, curves.Threshold.Evaluate(progress)),
                Mathf.Lerp(a.Softness, b.Softness, curves.Softness.Evaluate(progress)),
                Mathf.Lerp(a.OutMin, b.OutMin, curves.OutputMin.Evaluate(progress)),
                Mathf.Lerp(a.OutMax, b.OutMax, curves.OutputMax.Evaluate(progress))
                ));
 }
Пример #4
0
 public static DecalState Lerp(DecalState a, DecalState b, DecalStateCurves curves, float progress)
 {
     return(new DecalState(
                Mathf.Lerp(a.Saturation, b.Saturation, curves.Saturation.Evaluate(progress)),
                ChannelValues.Lerp(a.Red, b.Red, curves.Red, progress),
                ChannelValues.Lerp(a.Green, b.Green, curves.Green, progress),
                ChannelValues.Lerp(a.Blue, b.Blue, curves.Blue, progress),
                ChannelValues.Lerp(a.Alpha, b.Alpha, curves.Alpha, progress)
                ));
 }
 internal ComputedValues(FFTDependencyWrapper wrapper)
 {
     L = new ChannelValues {
         B = wrapper.BlueLight.Values[0], Y = wrapper.YellowLight.Values[0], isRightChannel = false
     };
     if (wrapper.TwoChannels)
     {
         twoChannels = true;
         R           = new ChannelValues {
             B = wrapper.BlueLight.Values[1], Y = wrapper.YellowLight.Values[1], isRightChannel = true
         };
     }
 }