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(component == null) return null; AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.delay = getWaitTime(frameRate,0f); a.go = component.gameObject.name; if(useSendMessage) { if(methodName == null) return null; a.method = "sendmessage"; a.strings = new string[]{methodName}; if(parameters != null && parameters.Count > 0) { // set one param ( parameters[0].toObject() ) a.eventParams = new AnimatorTimeline.JSONEventParameter[]{parameters[0].toJSON()}; } } else { if(methodInfo == null) return null; a.method = "invokemethod"; a.eventParams = new AnimatorTimeline.JSONEventParameter[parameters.Count]; for(int i=0;i<parameters.Count;i++) { a.eventParams[i] = parameters[i].toJSON(); } a.strings = new string[]{component.GetType().Name,methodInfo.Name}; } return a; }
public override AnimatorTimeline.JSONAction getJSONAction(int frameRate) { if (endFrame == -1 || !hasTargets() || targetsAreEqual()) { return(null); } AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.method = "camerafade"; a.delay = getWaitTime(frameRate, 0f); a.time = getTime(frameRate); setupJSONActionEase(a); a.ints = new int[] { cameraFadeType, startTargetType, endTargetType }; List <string> strings = new List <string>(); List <AnimatorTimeline.JSONColor> colors = new List <AnimatorTimeline.JSONColor>(); if (startTargetType == 0) { strings.Add(startCamera.gameObject.name); colors.Add(null); } else { AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor(); c.setValue(startColor); colors.Add(c); strings.Add(null); } if (endTargetType == 0) { strings.Add(endCamera.gameObject.name); colors.Add(null); } else { AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor(); c.setValue(endColor); colors.Add(c); strings.Add(null); } a.strings = strings.ToArray(); a.colors = colors.ToArray(); // reversed, rendertex a.bools = new bool[] { isReversed(), !still }; // textures if (AMCameraFade.needsTexture(cameraFadeType)) { a.stringsExtra = new string[] { irisShape.name } } ; //hash.Add("texture",irisShape); // parameters a.floats = cameraFadeParameters.ToArray(); return(a); } }
public void setupJSONActionEase(AnimatorTimeline.JSONAction a) { a.easeType = easeType; if (hasCustomEase()) { a.customEase = customEase.ToArray(); } else { a.customEase = new float[] {} }; }
public override AnimatorTimeline.JSONAction getJSONAction(int frameRate) { if(!audioSource || !audioClip) return null; AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.method = "playaudio"; a.go = audioSource.gameObject.name; a.delay = getWaitTime(frameRate,0f); a.strings = new string[]{audioClip.name}; a.bools = new bool[]{loop}; return a; }
private static void setupHashEase(Hashtable hashTable, AnimatorTimeline.JSONAction a) { if (a.customEase.Length > 0) { AnimationCurve easeCurve = AMTween.GenerateCurve(a.customEase); hashTable.Add("easecurve", easeCurve); } else { hashTable.Add("easetype", (AMTween.EaseType)a.easeType); } }
public override AnimatorTimeline.JSONAction getJSONAction(int frameRate) { if(!amClip || !obj) return null; AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.method = "playanimation"; a.go = obj.gameObject.name; a.delay = getWaitTime(frameRate,0f); a.strings = new string[]{amClip.name}; a.floats = new float[]{(float)wrapMode, crossfadeTime}; a.bools = new bool[]{crossfade}; 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; }
// JSON void exportJSON() { string takeName = aData.getCurrentTake().name; string saveJSONPath = EditorUtility.SaveFilePanel("Save JSON", "Assets/", takeName, "txt"); if (saveJSONPath == "") { return; } // start serialization AnimatorTimeline.JSONTake j = new AnimatorTimeline.JSONTake(); j.takeName = aData.getCurrentTake().name; List <AnimatorTimeline.JSONInit> lsInits = new List <AnimatorTimeline.JSONInit>(); List <AnimatorTimeline.JSONAction> lsActions = new List <AnimatorTimeline.JSONAction>(); foreach (AMTrack track in aData.getCurrentTake().trackValues) { if (dictTracks.ContainsKey(track.id) && dictTracks[track.id] == true) { // set initial values AnimatorTimeline.JSONInit init = track.getJSONInit(); if (init != null) { lsInits.Add(init); } // set actions foreach (AMAction action in track.cache) { AnimatorTimeline.JSONAction a = action.getJSONAction(aData.getCurrentTake().frameRate); if (a != null) { lsActions.Add(a); } } } } j.inits = lsInits.ToArray(); j.actions = lsActions.ToArray(); // serialize json string json = JsonWriter.Serialize(j); // write json to file File.WriteAllText(saveJSONPath, json); // refresh project directory AssetDatabase.Refresh(); // refresh code refreshCode(); }
public override AnimatorTimeline.JSONAction getJSONAction(int frameRate) { if (!audioSource || !audioClip) { return(null); } AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.method = "playaudio"; a.go = audioSource.gameObject.name; a.delay = getWaitTime(frameRate, 0f); a.strings = new string[] { audioClip.name }; a.bools = new bool[] { loop }; return(a); }
public override AnimatorTimeline.JSONAction getJSONAction(int frameRate) { if (!amClip || !obj) { return(null); } AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.method = "playanimation"; a.go = obj.gameObject.name; a.delay = getWaitTime(frameRate, 0f); a.strings = new string[] { amClip.name }; a.floats = new float[] { (float)wrapMode, crossfadeTime }; a.bools = new bool[] { crossfade }; 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); }
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 (component == null) { return(null); } AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.delay = getWaitTime(frameRate, 0f); a.go = component.gameObject.name; if (useSendMessage) { if (methodName == null) { return(null); } a.method = "sendmessage"; a.strings = new string[] { methodName }; if (parameters != null && parameters.Count > 0) { // set one param ( parameters[0].toObject() ) a.eventParams = new AnimatorTimeline.JSONEventParameter[] { parameters[0].toJSON() }; } } else { if (methodInfo == null) { return(null); } a.method = "invokemethod"; a.eventParams = new AnimatorTimeline.JSONEventParameter[parameters.Count]; for (int i = 0; i < parameters.Count; i++) { a.eventParams[i] = parameters[i].toJSON(); } a.strings = new string[] { component.GetType().Name, methodInfo.Name }; } return(a); }
public override AnimatorTimeline.JSONAction getJSONAction(int frameRate) { if(endFrame == -1 || !hasTargets() || targetsAreEqual()) return null; AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction(); a.method = "camerafade"; a.delay = getWaitTime(frameRate,0f); a.time = getTime(frameRate); setupJSONActionEase(a); a.ints = new int[]{cameraFadeType,startTargetType,endTargetType}; List<string> strings = new List<string>(); List<AnimatorTimeline.JSONColor> colors = new List<AnimatorTimeline.JSONColor>(); if(startTargetType == 0) { strings.Add(startCamera.gameObject.name); colors.Add(null); } else { AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor(); c.setValue(startColor); colors.Add(c); strings.Add(null); } if(endTargetType == 0) { strings.Add(endCamera.gameObject.name); colors.Add(null); } else { AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor(); c.setValue(endColor); colors.Add(c); strings.Add(null); } a.strings = strings.ToArray(); a.colors = colors.ToArray(); // reversed, rendertex a.bools = new bool[]{isReversed(), !still}; // textures if(AMCameraFade.needsTexture(cameraFadeType)) a.stringsExtra = new string[]{irisShape.name};//hash.Add("texture",irisShape); // parameters a.floats = cameraFadeParameters.ToArray(); 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); }