Esempio n. 1
0
 public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
 {
     if (!obj)
     {
         return(null);
     }
     if (path.Length <= 1)
     {
         return(null);
     }
     if (getNumberOfFrames() <= 0)
     {
         return(null);
     }
     AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
     a.go     = obj.gameObject.name;
     a.method = "moveto";
     a.delay  = getWaitTime(frameRate, 0f);
     a.time   = getTime(frameRate);
     setupJSONActionEase(a);
     // if line
     if (path.Length == 2)
     {
         a.setPath(new Vector3[] { path[1] });
         // if path
     }
     else
     {
         a.setPath(path);
     }
     return(a);
 }
    public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
    {
        if (!obj || endFrame == -1)
        {
            return(null);
        }
        AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
        a.go    = obj.gameObject.name;
        a.delay = getWaitTime(frameRate, 0f);
        a.time  = getTime(frameRate);
        if (isLookFollow())
        {
            a.method  = "lookfollow";
            a.strings = new string[] { startTarget.gameObject.name };
        }
        else
        {
            a.method  = "looktofollow";
            a.strings = new string[] { endTarget.gameObject.name };
            if (isSetEndPosition)
            {
                a.setPath(new Vector3[] { endPosition });
            }
        }

        setupJSONActionEase(a);

        return(a);
    }
 public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
 {
     if(!obj) return null;
     if(path.Length <=1) return null;
     if(getNumberOfFrames()<=0) return null;
     AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
     a.go = obj.gameObject.name;
     a.method = "moveto";
     a.delay = getWaitTime(frameRate,0f);
     a.time = getTime(frameRate);
     setupJSONActionEase(a);
     // if line
     if(path.Length == 2) {
         a.setPath(new Vector3[]{path[1]});
     // if path
     } else {
         a.setPath(path);
     }
     return a;
 }
 public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
 {
     if(!obj || endFrame == -1) return null;
     AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
     a.go = obj.gameObject.name;
     a.method = "rotateto";
     a.delay = getWaitTime(frameRate, 0f);
     a.time = getTime(frameRate);
     setupJSONActionEase(a);
     // set rotation
     a.setPath(new Vector3[]{endRotation.eulerAngles});
     return a;
 }
Esempio n. 5
0
 public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
 {
     if (!obj || endFrame == -1)
     {
         return(null);
     }
     AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
     a.go     = obj.gameObject.name;
     a.method = "rotateto";
     a.delay  = getWaitTime(frameRate, 0f);
     a.time   = getTime(frameRate);
     setupJSONActionEase(a);
     // set rotation
     a.setPath(new Vector3[] { endRotation.eulerAngles });
     return(a);
 }
    public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
    {
        if(!obj || endFrame == -1) return null;
        AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
        a.go = obj.gameObject.name;
        a.delay = getWaitTime(frameRate,0f);
        a.time = getTime(frameRate);
        if(isLookFollow()) {
            a.method = "lookfollow";
            a.strings = new string[]{startTarget.gameObject.name};

        } else {
            a.method = "looktofollow";
            a.strings = new string[]{endTarget.gameObject.name};
            if(isSetEndPosition) {
                a.setPath(new Vector3[]{endPosition});
            }
        }

        setupJSONActionEase(a);

        return a;
    }
    public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
    {
        if(targetsAreEqual()) return null;
        if((endFrame == -1) || !component || ((fieldInfo == null) && (propertyInfo == null) && (methodInfo == null))) return null;

        AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
        a.method = "propertyto";
        a.go = component.gameObject.name;
        a.delay = getWaitTime(frameRate,0f);
        a.time = getTime(frameRate);
        List<string> strings = new List<string>();
        strings.Add(component.GetType().Name);
        if(fieldInfo != null || propertyInfo != null) {
            if(valueType == (int)AMPropertyTrack.ValueType.Integer) {
                strings.Add("integer");
                a.ints = new int[]{Convert.ToInt32(start_val),Convert.ToInt32(end_val)};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Long) {
                strings.Add("long");
                a.longs = new long[]{Convert.ToInt64(start_val),Convert.ToInt64(end_val)};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Float) {
                strings.Add("float");
                a.floats = new float[]{Convert.ToSingle(start_val),Convert.ToSingle(end_val)};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Double) {
                strings.Add("double");
                a.doubles = new double[]{start_val,end_val};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Vector2) {
                strings.Add("vector2");
                AnimatorTimeline.JSONVector2 v1 = new AnimatorTimeline.JSONVector2();
                v1.setValue(start_vect2);
                AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
                v2.setValue(end_vect2);
                a.vect2s = new AnimatorTimeline.JSONVector2[]{v1,v2};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Vector3) {
                strings.Add("vector3");
                a.setPath(new Vector3[]{start_vect3,end_vect3});
            } else if(valueType == (int)AMPropertyTrack.ValueType.Color) {
                strings.Add("color");
                AnimatorTimeline.JSONColor c1 = new AnimatorTimeline.JSONColor();
                c1.setValue(start_color);
                AnimatorTimeline.JSONColor c2 = new AnimatorTimeline.JSONColor();
                c2.setValue(end_color);
                a.colors = new AnimatorTimeline.JSONColor[]{c1,c2};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Rect) {
                strings.Add("rect");
                AnimatorTimeline.JSONRect r1 = new AnimatorTimeline.JSONRect();
                r1.setValue(start_rect);
                AnimatorTimeline.JSONRect r2 = new AnimatorTimeline.JSONRect();
                r2.setValue(end_rect);
                a.rects = new AnimatorTimeline.JSONRect[]{r1,r2};
            }
            if(fieldInfo != null) {
                strings.Add("fieldinfo");
                strings.Add(fieldInfo.Name);
            } else {
                strings.Add("propertyinfo");
                strings.Add(propertyInfo.Name);
            }

        } else if(methodInfo != null) {
            if(valueType == (int)AMPropertyTrack.ValueType.MorphChannels) {
                strings.Add("morph");
                a.floats = start_morph.ToArray();
                a.floatsExtra = end_morph.ToArray();
            }
        }
        setupJSONActionEase(a);
        a.strings = strings.ToArray();
        return a;
    }
    public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
    {
        if (targetsAreEqual())
        {
            return(null);
        }
        if ((endFrame == -1) || !component || ((fieldInfo == null) && (propertyInfo == null) && (methodInfo == null)))
        {
            return(null);
        }

        AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
        a.method = "propertyto";
        a.go     = component.gameObject.name;
        a.delay  = getWaitTime(frameRate, 0f);
        a.time   = getTime(frameRate);
        List <string> strings = new List <string>();

        strings.Add(component.GetType().Name);
        if (fieldInfo != null || propertyInfo != null)
        {
            if (valueType == (int)AMPropertyTrack.ValueType.Integer)
            {
                strings.Add("integer");
                a.ints = new int[] { Convert.ToInt32(start_val), Convert.ToInt32(end_val) };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Long)
            {
                strings.Add("long");
                a.longs = new long[] { Convert.ToInt64(start_val), Convert.ToInt64(end_val) };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Float)
            {
                strings.Add("float");
                a.floats = new float[] { Convert.ToSingle(start_val), Convert.ToSingle(end_val) };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Double)
            {
                strings.Add("double");
                a.doubles = new double[] { start_val, end_val };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Vector2)
            {
                strings.Add("vector2");
                AnimatorTimeline.JSONVector2 v1 = new AnimatorTimeline.JSONVector2();
                v1.setValue(start_vect2);
                AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
                v2.setValue(end_vect2);
                a.vect2s = new AnimatorTimeline.JSONVector2[] { v1, v2 };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Vector3)
            {
                strings.Add("vector3");
                a.setPath(new Vector3[] { start_vect3, end_vect3 });
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Color)
            {
                strings.Add("color");
                AnimatorTimeline.JSONColor c1 = new AnimatorTimeline.JSONColor();
                c1.setValue(start_color);
                AnimatorTimeline.JSONColor c2 = new AnimatorTimeline.JSONColor();
                c2.setValue(end_color);
                a.colors = new AnimatorTimeline.JSONColor[] { c1, c2 };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Rect)
            {
                strings.Add("rect");
                AnimatorTimeline.JSONRect r1 = new AnimatorTimeline.JSONRect();
                r1.setValue(start_rect);
                AnimatorTimeline.JSONRect r2 = new AnimatorTimeline.JSONRect();
                r2.setValue(end_rect);
                a.rects = new AnimatorTimeline.JSONRect[] { r1, r2 };
            }
            if (fieldInfo != null)
            {
                strings.Add("fieldinfo");
                strings.Add(fieldInfo.Name);
            }
            else
            {
                strings.Add("propertyinfo");
                strings.Add(propertyInfo.Name);
            }
        }
        else if (methodInfo != null)
        {
            if (valueType == (int)AMPropertyTrack.ValueType.MorphChannels)
            {
                strings.Add("morph");
                a.floats      = start_morph.ToArray();
                a.floatsExtra = end_morph.ToArray();
            }
        }
        setupJSONActionEase(a);
        a.strings = strings.ToArray();
        return(a);
    }