Пример #1
0
        public override void ApplyInterpolation(ActorComponent component, float time, KeyFrame toFrame, float mix)
        {
            switch (m_InterpolationType)
            {
            case KeyFrame.InterpolationTypes.Mirrored:
            case KeyFrame.InterpolationTypes.Asymmetric:
            case KeyFrame.InterpolationTypes.Disconnected:
            {
                ValueTimeCurveInterpolator interpolator = m_Interpolator as ValueTimeCurveInterpolator;
                if (interpolator != null)
                {
                    float v = (float)interpolator.Get((double)time);
                    SetValue(component, v, mix);
                }
                break;
            }

            case KeyFrame.InterpolationTypes.Hold:
            {
                SetValue(component, m_Value, mix);
                break;
            }

            case KeyFrame.InterpolationTypes.Linear:
            {
                KeyFrameInt to = toFrame as KeyFrameInt;

                float f = (time - m_Time) / (to.m_Time - m_Time);
                SetValue(component, m_Value * (1.0f - f) + to.m_Value * f, mix);
                break;
            }
            }
        }
Пример #2
0
 public static bool Read(BinaryReader reader, KeyFrameInt frame)
 {
     if (!KeyFrameWithInterpolation.Read(reader, frame))
     {
         return(false);
     }
     frame.m_Value = reader.ReadInt32();
     return(true);
 }
Пример #3
0
        public static KeyFrame Read(BinaryReader reader, ActorComponent component)
        {
            KeyFrameIntProperty frame = new KeyFrameIntProperty();

            if (KeyFrameInt.Read(reader, frame))
            {
                return(frame);
            }
            return(null);
        }