Exemple #1
0
 public void AddKey <T>(float time, CurveBind <T> b) where T : struct
 {
     if (time >= 0)
     {
         this.animation.AddKey(time, b);
     }
 }
Exemple #2
0
 public void Sample <T>(CurveBind <T> bind, float t) where T : struct
 {
     if (HasKey(bind.key))
     {
         bind.v = Sample <T>(bind.key, t);
         bind.cb(bind.v);
     }
 }
Exemple #3
0
        protected void Draw <T>(CurveBind <T> b, bool recdMode, float time) where T : struct
        {
#if UNITY_EDITOR
            if (recdMode)
            {
                old       = GUI.color;
                GUI.color = Color.red;
                UnityEditor.EditorGUI.BeginChangeCheck();
            }
            if (typeof(T) == typeof(float))
            {
                b.v = EditorGUILayout.FloatField(b.key, (dynamic)b.v);
            }
            else if (typeof(T) == typeof(Color))
            {
                b.v = EditorGUILayout.ColorField(b.key, (dynamic)b.v);
            }
            else if (typeof(T) == typeof(Vector2))
            {
                b.v = EditorGUILayout.Vector2Field(b.key, (dynamic)b.v);
            }
            else if (typeof(T) == typeof(Vector3))
            {
                b.v = EditorGUILayout.Vector3Field(b.key, (dynamic)b.v);
            }
            else if (typeof(T) == typeof(Vector4))
            {
                b.v = EditorGUILayout.Vector4Field(b.key, (dynamic)b.v);
            }

            if (recdMode)
            {
                if (UnityEditor.EditorGUI.EndChangeCheck())
                {
                    AddKey(time, b);
                }
                GUI.color = old;
            }
#endif
        }
Exemple #4
0
 public XCurve(int len, CurveBind <T> cb)
 {
     length    = len;
     this.bind = cb.key;
     frames    = new XFrame <T> [len];
 }
Exemple #5
0
 public bool HasKey <T>(CurveBind <T> b) where T : struct
 {
     return(HasKey(b.key));
 }
Exemple #6
0
 public void AddKey <T>(float t, CurveBind <T> bind) where T : struct
 {
     AddKey(t, bind.key, bind.v);
 }