using System; using UnityEngine; [Serializable] public class AMRotationAction : AMAction { public override string ToString(int codeLanguage, int frameRate) { if (this.endFrame == -1) { return null; } string text; if (codeLanguage == 0) { text = string.Concat(new object[] { "AMTween.RotateTo (obj.gameObject, AMTween.Hash (\"delay\", ", base.getWaitTime(frameRate, 0f), "f, \"time\", ", this.getTime(frameRate), "f, " }); string text2 = text; text = string.Concat(new object[] { text2, "\"rotation\", new Vector3(", this.endRotation.eulerAngles.x, "f, ", this.endRotation.eulerAngles.y, "f, ", this.endRotation.eulerAngles.z, "f), " }); text = text + base.getEaseString(codeLanguage) + "));"; } else { text = string.Concat(new object[] { "AMTween.RotateTo (obj.gameObject, {\"delay\": ", base.getWaitTime(frameRate, 0f), ", \"time\": ", this.getTime(frameRate), ", " }); string text2 = text; text = string.Concat(new object[] { text2, "\"rotation\": Vector3(", this.endRotation.eulerAngles.x, ", ", this.endRotation.eulerAngles.y, ", ", this.endRotation.eulerAngles.z, "), " }); text = text + base.getEaseString(codeLanguage) + "});"; } return text; } public override int getNumberOfFrames() { return this.endFrame - this.startFrame; } public float getTime(int frameRate) { return (float)this.getNumberOfFrames() / (float)frameRate; } public override void execute(int frameRate, float delay, string trackId) { if (!this.obj) { return; } if (this.endFrame == -1) { return; } if (base.hasCustomEase()) { AMTween.RotateTo(this.obj.gameObject, AMTween.Hash(new object[] { "trackid", trackId, "delay", base.getWaitTime(frameRate, delay), "time", this.getTime(frameRate), "rotation", this.endRotation.eulerAngles, "easecurve", base.easeCurve })); } else { AMTween.RotateTo(this.obj.gameObject, AMTween.Hash(new object[] { "trackid", trackId, "delay", base.getWaitTime(frameRate, delay), "time", this.getTime(frameRate), "rotation", this.endRotation.eulerAngles, "easetype", (AMTween.EaseType)this.easeType })); } } public Quaternion getStartQuaternion() { return this.startRotation; } public Quaternion getEndQuaternion() { return this.endRotation; } public override AnimatorTimeline.JSONAction getJSONAction(int frameRate) { if (!this.obj || this.endFrame == -1) { return null; } AnimatorTimeline.JSONAction jsonaction = new AnimatorTimeline.JSONAction(); jsonaction.go = this.obj.gameObject.name; jsonaction.method = "rotateto"; jsonaction.delay = base.getWaitTime(frameRate, 0f); jsonaction.time = this.getTime(frameRate); base.setupJSONActionEase(jsonaction); jsonaction.setPath(new Vector3[] { this.endRotation.eulerAngles }); return jsonaction; } public int endFrame; public Transform obj; public Quaternion startRotation; public Quaternion endRotation; }