Ejemplo n.º 1
0
        protected Vector2 evaluateVector2(MemberClipCurveData memberData, float time)
        {
            Vector2 v;

            v.x = memberData.Curve1.Evaluate(time);
            v.y = memberData.Curve2.Evaluate(time);
            return(v);
        }
Ejemplo n.º 2
0
        protected object evaluate(MemberClipCurveData memberData, float time)
        {
            object value = null;

            switch (memberData.PropertyType)
            {
            case PropertyTypeInfo.Color:
                Color c;
                c.r   = memberData.Curve1.Evaluate(time);
                c.g   = memberData.Curve2.Evaluate(time);
                c.b   = memberData.Curve3.Evaluate(time);
                c.a   = memberData.Curve4.Evaluate(time);
                value = c;
                break;

            case PropertyTypeInfo.Double:
            case PropertyTypeInfo.Float:
            case PropertyTypeInfo.Int:
            case PropertyTypeInfo.Long:
                value = memberData.Curve1.Evaluate(time);
                break;

            case PropertyTypeInfo.Quaternion:
                Quaternion q;
                q.x   = memberData.Curve1.Evaluate(time);
                q.y   = memberData.Curve2.Evaluate(time);
                q.z   = memberData.Curve3.Evaluate(time);
                q.w   = memberData.Curve4.Evaluate(time);
                value = q;
                break;

            case PropertyTypeInfo.Vector2:
                Vector2 v2;
                v2.x  = memberData.Curve1.Evaluate(time);
                v2.y  = memberData.Curve2.Evaluate(time);
                value = v2;
                break;

            case PropertyTypeInfo.Vector3:
                Vector3 v3;
                v3.x  = memberData.Curve1.Evaluate(time);
                v3.y  = memberData.Curve2.Evaluate(time);
                v3.z  = memberData.Curve3.Evaluate(time);
                value = v3;
                break;

            case PropertyTypeInfo.Vector4:
                Vector4 v4;
                v4.x  = memberData.Curve1.Evaluate(time);
                v4.y  = memberData.Curve2.Evaluate(time);
                v4.z  = memberData.Curve3.Evaluate(time);
                v4.w  = memberData.Curve4.Evaluate(time);
                value = v4;
                break;
            }
            return(value);
        }
Ejemplo n.º 3
0
        protected Vector3 evaluateVector3(MemberClipCurveData memberData, float time)
        {
            Vector3 v3;

            v3.x = memberData.Curve1.Evaluate(time);
            v3.y = memberData.Curve2.Evaluate(time);
            v3.z = memberData.Curve3.Evaluate(time);
            return(v3);
        }
        protected object evaluate(MemberClipCurveData memberData, float time)
        {
            object value = null;
            switch (memberData.PropertyType)
            {
                case PropertyTypeInfo.Color:
                    Color c;
                    c.r = memberData.Curve1.Evaluate(time);
                    c.g = memberData.Curve2.Evaluate(time);
                    c.b = memberData.Curve3.Evaluate(time);
                    c.a = memberData.Curve4.Evaluate(time);
                    value = c;
                    break;

                case PropertyTypeInfo.Double:
                case PropertyTypeInfo.Float:
                case PropertyTypeInfo.Int:
                case PropertyTypeInfo.Long:
                    value = memberData.Curve1.Evaluate(time);
                    break;

                case PropertyTypeInfo.Quaternion:
                    Quaternion q;
                    q.x = memberData.Curve1.Evaluate(time);
                    q.y = memberData.Curve2.Evaluate(time);
                    q.z = memberData.Curve3.Evaluate(time);
                    q.w = memberData.Curve4.Evaluate(time);
                    value = q;
                    break;

                case PropertyTypeInfo.Vector2:
                    Vector2 v2;
                    v2.x = memberData.Curve1.Evaluate(time);
                    v2.y = memberData.Curve2.Evaluate(time);
                    value = v2;
                    break;

                case PropertyTypeInfo.Vector3:
                    Vector3 v3;
                    v3.x = memberData.Curve1.Evaluate(time);
                    v3.y = memberData.Curve2.Evaluate(time);
                    v3.z = memberData.Curve3.Evaluate(time);
                    value = v3;
                    break;

                case PropertyTypeInfo.Vector4:
                    Vector4 v4;
                    v4.x = memberData.Curve1.Evaluate(time);
                    v4.y = memberData.Curve2.Evaluate(time);
                    v4.z = memberData.Curve3.Evaluate(time);
                    v4.w = memberData.Curve4.Evaluate(time);
                    value = v4;
                    break;
            }
            return value;
        }
Ejemplo n.º 5
0
        protected override void initializeClipCurves(MemberClipCurveData data, Component component)
        {
#if PROFILE_FILE
            Profiler.BeginSample("CinemaActorClipCurve.initializeClipCurves");
#endif // PROFILE_FILE
            object           value     = GetCurrentValue(component, data.PropertyName, data.IsProperty);
            PropertyTypeInfo typeInfo  = data.PropertyType;
            float            startTime = Firetime;
            float            endTime   = Firetime + Duration;

            if (typeInfo == PropertyTypeInfo.Int || typeInfo == PropertyTypeInfo.Long || typeInfo == PropertyTypeInfo.Float || typeInfo == PropertyTypeInfo.Double)
            {
                float x = (float)value;
                data.Curve1 = AnimationCurve.Linear(startTime, x, endTime, x);
            }
            else if (typeInfo == PropertyTypeInfo.Vector2)
            {
                Vector2 vec2 = (Vector2)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec2.x, endTime, vec2.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec2.y, endTime, vec2.y);
            }
            else if (typeInfo == PropertyTypeInfo.Vector3)
            {
                Vector3 vec3 = (Vector3)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec3.x, endTime, vec3.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec3.y, endTime, vec3.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec3.z, endTime, vec3.z);
            }
            else if (typeInfo == PropertyTypeInfo.Vector4)
            {
                Vector4 vec4 = (Vector4)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec4.x, endTime, vec4.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec4.y, endTime, vec4.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec4.z, endTime, vec4.z);
                data.Curve4 = AnimationCurve.Linear(startTime, vec4.w, endTime, vec4.w);
            }
            else if (typeInfo == PropertyTypeInfo.Quaternion)
            {
                Quaternion quaternion = (Quaternion)value;
                data.Curve1 = AnimationCurve.Linear(startTime, quaternion.x, endTime, quaternion.x);
                data.Curve2 = AnimationCurve.Linear(startTime, quaternion.y, endTime, quaternion.y);
                data.Curve3 = AnimationCurve.Linear(startTime, quaternion.z, endTime, quaternion.z);
                data.Curve4 = AnimationCurve.Linear(startTime, quaternion.w, endTime, quaternion.w);
            }
            else if (typeInfo == PropertyTypeInfo.Color)
            {
                Color color = (Color)value;
                data.Curve1 = AnimationCurve.Linear(startTime, color.r, endTime, color.r);
                data.Curve2 = AnimationCurve.Linear(startTime, color.g, endTime, color.g);
                data.Curve3 = AnimationCurve.Linear(startTime, color.b, endTime, color.b);
                data.Curve4 = AnimationCurve.Linear(startTime, color.a, endTime, color.a);
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }
Ejemplo n.º 6
0
        protected Color evaluateColor(MemberClipCurveData memberData, float time)
        {
            Color v;

            v.r = memberData.Curve1.Evaluate(time);
            v.g = memberData.Curve2.Evaluate(time);
            v.b = memberData.Curve3.Evaluate(time);
            v.a = memberData.Curve4.Evaluate(time);
            return(v);
        }
Ejemplo n.º 7
0
        protected Quaternion evaluateQuaternion(MemberClipCurveData memberData, float time)
        {
            Quaternion v;

            v.x = memberData.Curve1.Evaluate(time);
            v.y = memberData.Curve2.Evaluate(time);
            v.z = memberData.Curve3.Evaluate(time);
            v.w = memberData.Curve4.Evaluate(time);
            return(v);
        }
Ejemplo n.º 8
0
        protected Vector4 evaluateVector4(MemberClipCurveData memberData, float time)
        {
            Vector4 v;

            v.x = memberData.Curve1.Evaluate(time);
            v.y = memberData.Curve2.Evaluate(time);
            v.z = memberData.Curve3.Evaluate(time);
            v.w = memberData.Curve4.Evaluate(time);
            return(v);
        }
 public void AddClipCurveData(Component component, string name, bool isProperty, Type type)
 {
     MemberClipCurveData data = new MemberClipCurveData();
     data.Type = component.GetType().Name;
     data.PropertyName = name;
     data.IsProperty = isProperty;
     data.PropertyType = UnityPropertyTypeInfo.GetMappedType(type);
     initializeClipCurves(data, component);
     curveData.Add(data);
 }
Ejemplo n.º 10
0
        public void AddClipCurveData(Component component, string name, bool isProperty, Type type)
        {
            MemberClipCurveData data = new MemberClipCurveData();

            data.Type         = component.GetType().Name;
            data.PropertyName = name;
            data.IsProperty   = isProperty;
            data.PropertyType = UnityPropertyTypeInfo.GetMappedType(type);
            initializeClipCurves(data, component);
            curveData.Add(data);
        }
Ejemplo n.º 11
0
        public override void initializeClipCurves(MemberClipCurveData data, Component component, PropertyTypeInfo propertyTypeInfo = PropertyTypeInfo.None)
        {
            object           value     = GetCurrentValue(component, data.PropertyName, data.IsProperty, data.PropertyType);
            PropertyTypeInfo typeInfo  = data.PropertyType;
            float            startTime = Firetime;
            float            endTime   = Firetime + Duration;

            if (typeInfo == PropertyTypeInfo.Int || typeInfo == PropertyTypeInfo.Long || typeInfo == PropertyTypeInfo.Float || typeInfo == PropertyTypeInfo.Double)
            {
                float x = (float)value;
                data.Curve1 = AnimationCurve.Linear(startTime, x, endTime, x);
            }
            else if (typeInfo == PropertyTypeInfo.Vector2)
            {
                Vector2 vec2 = (Vector2)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec2.x, endTime, vec2.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec2.y, endTime, vec2.y);
            }
            else if (typeInfo == PropertyTypeInfo.Vector3)
            {
                Vector3 vec3 = (Vector3)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec3.x, endTime, vec3.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec3.y, endTime, vec3.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec3.z, endTime, vec3.z);
            }
            else if (typeInfo == PropertyTypeInfo.Vector4)
            {
                Vector4 vec4 = (Vector4)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec4.x, endTime, vec4.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec4.y, endTime, vec4.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec4.z, endTime, vec4.z);
                data.Curve4 = AnimationCurve.Linear(startTime, vec4.w, endTime, vec4.w);
            }
            else if (typeInfo == PropertyTypeInfo.Quaternion)
            {
                Quaternion quaternion = (Quaternion)value;
                data.Curve1 = AnimationCurve.Linear(startTime, quaternion.x, endTime, quaternion.x);
                data.Curve2 = AnimationCurve.Linear(startTime, quaternion.y, endTime, quaternion.y);
                data.Curve3 = AnimationCurve.Linear(startTime, quaternion.z, endTime, quaternion.z);
                data.Curve4 = AnimationCurve.Linear(startTime, quaternion.w, endTime, quaternion.w);
            }
            else if (typeInfo == PropertyTypeInfo.Color)
            {
                Color color = (Color)value;
                data.Curve1 = AnimationCurve.Linear(startTime, color.r, endTime, color.r);
                data.Curve2 = AnimationCurve.Linear(startTime, color.g, endTime, color.g);
                data.Curve3 = AnimationCurve.Linear(startTime, color.b, endTime, color.b);
                data.Curve4 = AnimationCurve.Linear(startTime, color.a, endTime, color.a);
            }
        }
        protected override void initializeClipCurves(MemberClipCurveData data, Component component)
        {
            object value = GetCurrentValue(component, data.PropertyName, data.IsProperty);
            PropertyTypeInfo typeInfo = data.PropertyType;
            float startTime = Firetime;
            float endTime = Firetime + Duration;

            if (typeInfo == PropertyTypeInfo.Int || typeInfo == PropertyTypeInfo.Long || typeInfo == PropertyTypeInfo.Float || typeInfo == PropertyTypeInfo.Double)
            {
                float x = (float)value;
                data.Curve1 = AnimationCurve.Linear(startTime, x, endTime, x);
            }
            else if (typeInfo == PropertyTypeInfo.Vector2)
            {
                Vector2 vec2 = (Vector2)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec2.x, endTime, vec2.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec2.y, endTime, vec2.y);
            }
            else if (typeInfo == PropertyTypeInfo.Vector3)
            {
                Vector3 vec3 = (Vector3)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec3.x, endTime, vec3.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec3.y, endTime, vec3.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec3.z, endTime, vec3.z);
            }
            else if (typeInfo == PropertyTypeInfo.Vector4)
            {
                Vector4 vec4 = (Vector4)value;
                data.Curve1 = AnimationCurve.Linear(startTime, vec4.x, endTime, vec4.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec4.y, endTime, vec4.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec4.z, endTime, vec4.z);
                data.Curve4 = AnimationCurve.Linear(startTime, vec4.w, endTime, vec4.w);
            }
            else if (typeInfo == PropertyTypeInfo.Quaternion)
            {
                Quaternion quaternion = (Quaternion)value;
                data.Curve1 = AnimationCurve.Linear(startTime, quaternion.x, endTime, quaternion.x);
                data.Curve2 = AnimationCurve.Linear(startTime, quaternion.y, endTime, quaternion.y);
                data.Curve3 = AnimationCurve.Linear(startTime, quaternion.z, endTime, quaternion.z);
                data.Curve4 = AnimationCurve.Linear(startTime, quaternion.w, endTime, quaternion.w);
            }
            else if (typeInfo == PropertyTypeInfo.Color)
            {
                Color color = (Color)value;
                data.Curve1 = AnimationCurve.Linear(startTime, color.r, endTime, color.r);
                data.Curve2 = AnimationCurve.Linear(startTime, color.g, endTime, color.g);
                data.Curve3 = AnimationCurve.Linear(startTime, color.b, endTime, color.b);
                data.Curve4 = AnimationCurve.Linear(startTime, color.a, endTime, color.a);
            }
        }
Ejemplo n.º 13
0
 private void SetEndInfo(MemberClipCurveData data)
 {
     if (_EndInfoType != EndInfoType.Common)
     {
         Keyframe kf1     = new Keyframe();
         Keyframe kf2     = new Keyframe();
         Keyframe kf3     = new Keyframe();
         int      length1 = data.Curve1.length;
         int      length2 = data.Curve2.length;
         int      length3 = data.Curve3.length;
         kf1.time = data.Curve1.keys[length1 - 1].time;
         kf2.time = data.Curve2.keys[length2 - 1].time;
         kf3.time = data.Curve3.keys[length3 - 1].time;
         Transform trans = null;
         if (_EndInfoType == EndInfoType.HostPlayer)
         {
             trans = Main.HostPalyer;
         }
         else
         {
             trans = Main.Main3DCamera.transform;
         }
         if (data._CurveDataType == CurveDataType.Transform)
         {
             if (data._CurveDataPropertyName == CurveDataPropertyName.Scale)
             {
                 kf1.value = trans.localScale.x;
                 kf2.value = trans.localScale.y;
                 kf3.value = trans.localScale.z;
             }
             else if (data._CurveDataPropertyName == CurveDataPropertyName.Rotation)
             {
                 kf1.value = trans.localEulerAngles.x;
                 kf2.value = trans.localEulerAngles.y;
                 kf3.value = trans.localEulerAngles.z;
             }
             else
             {
                 kf1.value = trans.position.x;
                 kf2.value = trans.position.y;
                 kf3.value = trans.position.z;
             }
         }
         data.Curve1.MoveKey(length1 - 1, kf1);
         data.Curve2.MoveKey(length2 - 1, kf2);
         data.Curve3.MoveKey(length3 - 1, kf3);
     }
 }
Ejemplo n.º 14
0
        public void AddClipCurveData(Component component, string name, bool isProperty, Type type)
        {
#if PROFILE_FILE
            Profiler.BeginSample("CinemaClipCurve.AddClipCurveData");
#endif // PROFILE_FILE
            MemberClipCurveData data = new MemberClipCurveData();
            data.Type         = component.GetType().Name;
            data.PropertyName = name;
            data.IsProperty   = isProperty;
            data.PropertyType = UnityPropertyTypeInfo.GetMappedType(type);
            initializeClipCurves(data, component);
            curveData.Add(data);
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }
Ejemplo n.º 15
0
        public void AddClipCurveData(Component component, string name, bool isProperty, Type type)
        {
            MemberClipCurveData data = new MemberClipCurveData();

            data.Type         = component.GetType().Name;
            data.PropertyName = name;
            data.IsProperty   = isProperty;
            data.PropertyType = UnityPropertyTypeInfo.GetMappedType(type);
            if (initializeClipCurves(data, component))
            {
                curveData.Add(data);
            }
            else
            {
                Debug.LogError("Could not initialize curve clip, invalid initial values.");
            }
        }
Ejemplo n.º 16
0
 private void SetStartInfo(MemberClipCurveData data)
 {
     if (_StartInfoType != StartInfoType.Common)
     {
         Keyframe kf1 = new Keyframe();
         Keyframe kf2 = new Keyframe();
         Keyframe kf3 = new Keyframe();
         kf1.time = 0;
         kf2.time = 0;
         kf3.time = 0;
         Transform trans = null;
         if (_StartInfoType == StartInfoType.HostPlayer)
         {
             trans = Main.HostPalyer;
         }
         else
         {
             trans = Main.Main3DCamera.transform;
         }
         if (data._CurveDataType == CurveDataType.Transform)
         {
             if (data._CurveDataPropertyName == CurveDataPropertyName.Scale)
             {
                 kf1.value = trans.localScale.x;
                 kf2.value = trans.localScale.y;
                 kf3.value = trans.localScale.z;
             }
             else if (data._CurveDataPropertyName == CurveDataPropertyName.Rotation)
             {
                 kf1.value = trans.localEulerAngles.x;
                 kf2.value = trans.localEulerAngles.y;
                 kf3.value = trans.localEulerAngles.z;
             }
             else
             {
                 kf1.value = trans.position.x;
                 kf2.value = trans.position.y;
                 kf3.value = trans.position.z;
             }
         }
         data.Curve1.MoveKey(0, kf1);
         data.Curve2.MoveKey(0, kf2);
         data.Curve3.MoveKey(0, kf3);
     }
 }
        public override void Initialize()
        {
            MemberClipCurveData data = CurveData[0];

            if (data == null)
            {
                return;
            }
            cache.Clear();

            for (int i = 0; i < Actors.Count; i++)
            {
                object value = null;
                if (Components[i] != null && Properties[i] != null && Properties[i] != "None")
                {
                    value = Components[i].GetType().GetProperty(Properties[i]).GetValue(Components[i], null);
                }
                cache.Add(value);
            }
        }
        protected override bool initializeClipCurves(MemberClipCurveData data, Component component)
        {
            object           value     = GetCurrentValue(component, data.PropertyName, data.IsProperty);
            PropertyTypeInfo typeInfo  = data.PropertyType;
            float            startTime = Firetime;
            float            endTime   = Firetime + Duration;

            if (typeInfo == PropertyTypeInfo.Int || typeInfo == PropertyTypeInfo.Long || typeInfo == PropertyTypeInfo.Float || typeInfo == PropertyTypeInfo.Double)
            {
                float x;
                float.TryParse(value.ToString(), out x);

                if (float.IsInfinity(x) || float.IsNaN(x))
                {
                    return(false);
                }

                data.Curve1 = AnimationCurve.Linear(startTime, x, endTime, x);
            }
            else if (typeInfo == PropertyTypeInfo.Vector2)
            {
                Vector2 vec2 = (Vector2)value;

                if (float.IsInfinity(vec2.x) || float.IsNaN(vec2.x) ||
                    float.IsInfinity(vec2.y) || float.IsNaN(vec2.y))
                {
                    return(false);
                }

                data.Curve1 = AnimationCurve.Linear(startTime, vec2.x, endTime, vec2.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec2.y, endTime, vec2.y);
            }
            else if (typeInfo == PropertyTypeInfo.Vector3)
            {
                Vector3 vec3 = (Vector3)value;

                if (float.IsInfinity(vec3.x) || float.IsNaN(vec3.x) ||
                    float.IsInfinity(vec3.y) || float.IsNaN(vec3.y) ||
                    float.IsInfinity(vec3.z) || float.IsNaN(vec3.z))
                {
                    return(false);
                }

                data.Curve1 = AnimationCurve.Linear(startTime, vec3.x, endTime, vec3.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec3.y, endTime, vec3.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec3.z, endTime, vec3.z);
            }
            else if (typeInfo == PropertyTypeInfo.Vector4)
            {
                Vector4 vec4 = (Vector4)value;

                if (float.IsInfinity(vec4.x) || float.IsNaN(vec4.x) ||
                    float.IsInfinity(vec4.y) || float.IsNaN(vec4.y) ||
                    float.IsInfinity(vec4.z) || float.IsNaN(vec4.z) ||
                    float.IsInfinity(vec4.w) || float.IsNaN(vec4.w))
                {
                    return(false);
                }

                data.Curve1 = AnimationCurve.Linear(startTime, vec4.x, endTime, vec4.x);
                data.Curve2 = AnimationCurve.Linear(startTime, vec4.y, endTime, vec4.y);
                data.Curve3 = AnimationCurve.Linear(startTime, vec4.z, endTime, vec4.z);
                data.Curve4 = AnimationCurve.Linear(startTime, vec4.w, endTime, vec4.w);
            }
            else if (typeInfo == PropertyTypeInfo.Quaternion)
            {
                Quaternion quaternion = (Quaternion)value;

                if (float.IsInfinity(quaternion.x) || float.IsNaN(quaternion.x) ||
                    float.IsInfinity(quaternion.y) || float.IsNaN(quaternion.y) ||
                    float.IsInfinity(quaternion.z) || float.IsNaN(quaternion.z) ||
                    float.IsInfinity(quaternion.w) || float.IsNaN(quaternion.w))
                {
                    return(false);
                }

                data.Curve1 = AnimationCurve.Linear(startTime, quaternion.x, endTime, quaternion.x);
                data.Curve2 = AnimationCurve.Linear(startTime, quaternion.y, endTime, quaternion.y);
                data.Curve3 = AnimationCurve.Linear(startTime, quaternion.z, endTime, quaternion.z);
                data.Curve4 = AnimationCurve.Linear(startTime, quaternion.w, endTime, quaternion.w);
            }
            else if (typeInfo == PropertyTypeInfo.Color)
            {
                Color color = (Color)value;

                if (float.IsInfinity(color.r) || float.IsNaN(color.r) ||
                    float.IsInfinity(color.g) || float.IsNaN(color.g) ||
                    float.IsInfinity(color.b) || float.IsNaN(color.b) ||
                    float.IsInfinity(color.a) || float.IsNaN(color.a))
                {
                    return(false);
                }

                data.Curve1 = AnimationCurve.Linear(startTime, color.r, endTime, color.r);
                data.Curve2 = AnimationCurve.Linear(startTime, color.g, endTime, color.g);
                data.Curve3 = AnimationCurve.Linear(startTime, color.b, endTime, color.b);
                data.Curve4 = AnimationCurve.Linear(startTime, color.a, endTime, color.a);
            }

            return(true);
        }
 protected virtual void initializeClipCurves(MemberClipCurveData data, Component component) { }
Ejemplo n.º 20
0
        public void SampleTime(float time)
        {
            if (Firetime <= time && time <= Firetime + Duration)
            {
                MemberClipCurveData data = CurveData[0];
                if (data == null)
                {
                    return;
                }

                if (data.PropertyType == PropertyTypeInfo.None)
                {
                    return;
                }

                for (int i = 0; i < Components.Count; i++)
                {
                    object value = null;
                    switch (data.PropertyType)
                    {
                    case PropertyTypeInfo.Color:
                        Color c;
                        c.r   = data.Curve1.Evaluate(time);
                        c.g   = data.Curve2.Evaluate(time);
                        c.b   = data.Curve3.Evaluate(time);
                        c.a   = data.Curve4.Evaluate(time);
                        value = c;
                        break;

                    case PropertyTypeInfo.Double:
                    case PropertyTypeInfo.Float:
                    case PropertyTypeInfo.Int:
                    case PropertyTypeInfo.Long:
                        value = data.Curve1.Evaluate(time);
                        break;

                    case PropertyTypeInfo.Quaternion:
                        Quaternion q;
                        q.x   = data.Curve1.Evaluate(time);
                        q.y   = data.Curve2.Evaluate(time);
                        q.z   = data.Curve3.Evaluate(time);
                        q.w   = data.Curve4.Evaluate(time);
                        value = q;
                        break;

                    case PropertyTypeInfo.Vector2:
                        Vector2 v2;
                        v2.x  = data.Curve1.Evaluate(time);
                        v2.y  = data.Curve2.Evaluate(time);
                        value = v2;
                        break;

                    case PropertyTypeInfo.Vector3:
                        Vector3 v3;
                        v3.x  = data.Curve1.Evaluate(time);
                        v3.y  = data.Curve2.Evaluate(time);
                        v3.z  = data.Curve3.Evaluate(time);
                        value = v3;
                        break;

                    case PropertyTypeInfo.Vector4:
                        Vector4 v4;
                        v4.x  = data.Curve1.Evaluate(time);
                        v4.y  = data.Curve2.Evaluate(time);
                        v4.z  = data.Curve3.Evaluate(time);
                        v4.w  = data.Curve4.Evaluate(time);
                        value = v4;
                        break;
                    }
                    if (Components[i] != null && Properties[i] != null && Properties[i] != "None")
                    {
                        Components[i].GetType().GetProperty(Properties[i]).SetValue(Components[i], value, null);
                    }
                }
            }
        }
Ejemplo n.º 21
0
        protected double evaluateNumbber(MemberClipCurveData memberData, float time)
        {
            double v = memberData.Curve1.Evaluate(time);

            return(v);
        }
Ejemplo n.º 22
0
 protected virtual bool initializeClipCurves(MemberClipCurveData data, Component component)
 {
     return(false);
 }
        public void SampleTime(float time)
        {
#if PROFILE_FILE
            Profiler.BeginSample("CinemaMultiActorCurveClip.SampleTime");
#endif // PROFILE_FILE
            if (Firetime <= time && time <= Firetime + Duration)
            {
                MemberClipCurveData data = CurveData[0];
                if (data == null)
                {
#if PROFILE_FILE
                    Profiler.EndSample();
#endif // PROFILE_FILE
                    return;
                }

                if (data.PropertyType == PropertyTypeInfo.None)
                {
#if PROFILE_FILE
                    Profiler.EndSample();
#endif // PROFILE_FILE
                    return;
                }

                var count = Components.Count;

                for (int i = 0; i < count; i++)
                {
                    object value = null;
                    switch (data.PropertyType)
                    {
                    case PropertyTypeInfo.Color:
                        Color c;
                        c.r   = data.Curve1.Evaluate(time);
                        c.g   = data.Curve2.Evaluate(time);
                        c.b   = data.Curve3.Evaluate(time);
                        c.a   = data.Curve4.Evaluate(time);
                        value = c;
                        break;

                    case PropertyTypeInfo.Double:
                    case PropertyTypeInfo.Float:
                    case PropertyTypeInfo.Int:
                    case PropertyTypeInfo.Long:
                        value = data.Curve1.Evaluate(time);
                        break;

                    case PropertyTypeInfo.Quaternion:
                        Quaternion q;
                        q.x   = data.Curve1.Evaluate(time);
                        q.y   = data.Curve2.Evaluate(time);
                        q.z   = data.Curve3.Evaluate(time);
                        q.w   = data.Curve4.Evaluate(time);
                        value = q;
                        break;

                    case PropertyTypeInfo.Vector2:
                        Vector2 v2;
                        v2.x  = data.Curve1.Evaluate(time);
                        v2.y  = data.Curve2.Evaluate(time);
                        value = v2;
                        break;

                    case PropertyTypeInfo.Vector3:
                        Vector3 v3;
                        v3.x  = data.Curve1.Evaluate(time);
                        v3.y  = data.Curve2.Evaluate(time);
                        v3.z  = data.Curve3.Evaluate(time);
                        value = v3;
                        break;

                    case PropertyTypeInfo.Vector4:
                        Vector4 v4;
                        v4.x  = data.Curve1.Evaluate(time);
                        v4.y  = data.Curve2.Evaluate(time);
                        v4.z  = data.Curve3.Evaluate(time);
                        v4.w  = data.Curve4.Evaluate(time);
                        value = v4;
                        break;
                    }
                    var component = Components[i];
                    var property  = Properties[i];
                    if (component != null && property != null && property != "None")
                    {
                        if (ReflectionHelper.UseCodeGen)
                        {
                            ComponentReflectionExt.FastSetter(component, property, value);
                        }
                        else
                        {
                            PropertyInfo propertyInfo = ReflectionHelper.GetProperty(component.GetType(), property);
                            propertyInfo.SetValue(component, value, null);
                        }
                    }
                }
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
        }
Ejemplo n.º 24
0
        protected object evaluate(MemberClipCurveData memberData, float time)
        {
#if PROFILE_FILE
            Profiler.BeginSample("CinemaClipCurve.evaluate");
#endif // PROFILE_FILE

            object value = null;

            switch (memberData.PropertyType)
            {
            case PropertyTypeInfo.Color:
                Color c;
                c.r   = memberData.Curve1.Evaluate(time);
                c.g   = memberData.Curve2.Evaluate(time);
                c.b   = memberData.Curve3.Evaluate(time);
                c.a   = memberData.Curve4.Evaluate(time);
                value = c;
                break;

            case PropertyTypeInfo.Double:
            case PropertyTypeInfo.Float:
            case PropertyTypeInfo.Int:
            case PropertyTypeInfo.Long:
                value = memberData.Curve1.Evaluate(time);
                break;

            case PropertyTypeInfo.Quaternion:
                Quaternion q;
                q.x   = memberData.Curve1.Evaluate(time);
                q.y   = memberData.Curve2.Evaluate(time);
                q.z   = memberData.Curve3.Evaluate(time);
                q.w   = memberData.Curve4.Evaluate(time);
                value = q;
                break;

            case PropertyTypeInfo.Vector2:
                Vector2 v2;
                v2.x  = memberData.Curve1.Evaluate(time);
                v2.y  = memberData.Curve2.Evaluate(time);
                value = v2;
                break;

            case PropertyTypeInfo.Vector3:
                Vector3 v3;
                v3.x  = memberData.Curve1.Evaluate(time);
                v3.y  = memberData.Curve2.Evaluate(time);
                v3.z  = memberData.Curve3.Evaluate(time);
                value = v3;
                break;

            case PropertyTypeInfo.Vector4:
                Vector4 v4;
                v4.x  = memberData.Curve1.Evaluate(time);
                v4.y  = memberData.Curve2.Evaluate(time);
                v4.z  = memberData.Curve3.Evaluate(time);
                v4.w  = memberData.Curve4.Evaluate(time);
                value = v4;
                break;
            }
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE
            return(value);
        }
Ejemplo n.º 25
0
 public virtual void initializeClipCurves(MemberClipCurveData data, Component component, PropertyTypeInfo propertyTypeInfo = PropertyTypeInfo.None)
 {
 }
Ejemplo n.º 26
0
 protected virtual void initializeClipCurves(MemberClipCurveData data, Component component)
 {
 }