using System; using System.Collections; using System.Reflection; using UnityEngine; public class AMTween : MonoBehaviour { private static AMCameraFade cf { get { return AMCameraFade.getCameraFade(false); } } public static bool isTransitionReversed(int transition, float[] r) { switch (transition) { case 3: case 4: case 6: if (r.Length >= 1 && r[0] == 1f) { return true; } break; } return false; } public static void Init(GameObject target) { AMTween.MoveBy(target, Vector3.zero, 0f, string.Empty); } public static void CameraFade(AMTween.Fade type, bool useRenderTexture, float[] parameters, Hashtable args) { AMTween.CameraFade((int)type, useRenderTexture, parameters, args); } public static void CameraFade(int type, bool useRenderTexture, float[] parameters, Hashtable args) { args = AMTween.CleanArgs(args); bool flag = false; if ((type != 5 && !args.Contains("camera1") && !args.Contains("color1")) || (!args.Contains("camera2") && !args.Contains("color2"))) { flag = true; } else if (type != 5 && args.Contains("camera1") && (args["camera1"] == null || args["camera1"].GetType() != typeof(Camera))) { flag = true; } else if (args.Contains("camera2") && (args["camera2"] == null || args["camera2"].GetType() != typeof(Camera))) { flag = true; } else if (type != 5 && args.Contains("color1") && (args["color1"] == null || args["color1"].GetType() != typeof(Color))) { flag = true; } else if (args.Contains("color2") && (args["color2"] == null || args["color2"].GetType() != typeof(Color))) { flag = true; } if (flag) { Debug.LogWarning("AMTween: CameraFade requires at least two arguments; Camera 'camera1' or Color 'color1' and Camera 'camera2' or Color 'color2'."); return; } if (!args.Contains("reversed") || args["reversed"].GetType() != typeof(bool)) { args["reversed"] = false; } if (!args.Contains("allcameras") || args["allcameras"].GetType() != typeof(Camera[])) { args["allcameras"] = (Camera[])UnityEngine.Object.FindObjectsOfType(typeof(Camera)); } if (args.Contains("texture")) { bool flag2 = false; if (args["texture"] == null) { flag2 = true; } else if (args["texture"].GetType() != typeof(Texture2D)) { Debug.LogWarning("AMTween: CameraFade parameter 'irisshape' must be a Texture2D! No texture will be used."); flag2 = true; } if (flag2) { args.Remove("texture"); } } AMTween.cf.incrementKeepAlives(); args["type"] = "camerafade"; args["camerafadetype"] = type; args["userendertex"] = useRenderTexture; args["parameters"] = parameters; AMTween.Launch(AMTween.cf.gameObject, args); } public static void CameraFadeFrom(float amount, float time, string trackId) { if (AMTween.cameraFade) { AMTween.CameraFadeFrom(AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } else { Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); } } public static void CameraFadeFrom(Hashtable args) { if (AMTween.cameraFade) { AMTween.ColorFrom(AMTween.cameraFade, args); } else { Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); } } public static void CameraFadeTo(float amount, float time, string trackId) { if (AMTween.cameraFade) { AMTween.CameraFadeTo(AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } else { Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); } } public static void CameraFadeTo(Hashtable args) { if (AMTween.cameraFade) { AMTween.ColorTo(AMTween.cameraFade, args); } else { Debug.LogError("AMTween Error: You must first add a camera fade object with CameraFadeAdd() before atttempting to use camera fading."); } } public static void ValueTo(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (!args.Contains("onupdate") || !args.Contains("from") || !args.Contains("to")) { Debug.LogError("AMTween Error: ValueTo() requires an 'onupdate' callback function and a 'from' and 'to' property. The supplied 'onupdate' callback must accept a single argument that is the same type as the supplied 'from' and 'to' properties!"); return; } args["type"] = "value"; if (args["from"].GetType() == typeof(Vector2)) { args["method"] = "vector2"; } else if (args["from"].GetType() == typeof(Vector3)) { args["method"] = "vector3"; } else if (args["from"].GetType() == typeof(Rect)) { args["method"] = "rect"; } else if (args["from"].GetType() == typeof(float)) { args["method"] = "float"; } else { if (args["from"].GetType() != typeof(Color)) { Debug.LogError("AMTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!"); return; } args["method"] = "color"; } if (!args.Contains("easetype")) { args.Add("easetype", AMTween.EaseType.linear); } AMTween.Launch(target, args); } public static void PropertyTo(Component component, Hashtable args) { args = AMTween.CleanArgs(args); if (!args.Contains("fieldinfo") && !args.Contains("propertyinfo") && !args.Contains("methodinfo")) { Debug.LogError("AMTween Error: PropertyTo() requires a valid 'fieldinfo', 'propertyinfo' or 'methodinfo'."); return; } if (!args.Contains("from") || !args.Contains("to")) { Debug.LogError("AMTween Error: PropertyTo() requires a 'from' and 'to' property."); return; } args["type"] = "property"; if (args.Contains("methodtype")) { if (!((string)args["methodtype"] == "morph")) { Debug.LogError("AMTween Error: Invalid method type '" + args["methodtype"] + "' supplied!"); return; } args["method"] = "morph"; if (!args.Contains("from") || args["from"].GetType() != typeof(float[]) || !args.Contains("to") || args["to"].GetType() != typeof(float[])) { Debug.LogError("AMTween Error: Morph requires from and to targets of type float[]!"); return; } } else if (args["from"].GetType() == typeof(Vector2)) { args["method"] = "vector2"; } else if (args["from"].GetType() == typeof(Vector3)) { args["method"] = "vector3"; } else if (args["from"].GetType() == typeof(Rect)) { args["method"] = "rect"; } else if (args["from"].GetType() == typeof(float)) { args["method"] = "float"; } else { if (args["from"].GetType() != typeof(Color)) { Debug.LogError("AMTween Error: PropertyTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!"); return; } args["method"] = "color"; } if (!args.Contains("easetype")) { args.Add("easetype", AMTween.EaseType.linear); } AMTween.Launch(component, args); } public static void InvokeMethod(Component component, Hashtable args) { args = AMTween.CleanArgs(args); if (!args.Contains("methodinfo")) { Debug.LogError("AMTween Error: InvokeMethod() requires a parameter 'methodinfo'."); return; } args["type"] = "invoke"; args["method"] = "method"; AMTween.Launch(component, args); } public static void FadeFrom(GameObject target, float alpha, float time, string trackId) { AMTween.FadeFrom(target, AMTween.Hash(new object[] { "trackid", trackId, "alpha", alpha, "time", time })); } public static void FadeFrom(GameObject target, Hashtable args) { AMTween.ColorFrom(target, args); } public static void FadeTo(GameObject target, float alpha, float time, string trackId) { AMTween.FadeTo(target, AMTween.Hash(new object[] { "trackid", trackId, "alpha", alpha, "time", time })); } public static void FadeTo(GameObject target, Hashtable args) { AMTween.ColorTo(target, args); } public static void ColorFrom(GameObject target, Color color, float time, string trackId) { AMTween.ColorFrom(target, AMTween.Hash(new object[] { "trackid", trackId, "color", color, "time", time })); } public static void ColorFrom(GameObject target, Hashtable args) { Color color = default(Color); Color color2 = default(Color); args = AMTween.CleanArgs(args); if (!args.Contains("includechildren") || (bool)args["includechildren"]) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; Hashtable hashtable = (Hashtable)args.Clone(); hashtable["ischild"] = true; AMTween.ColorFrom(transform.gameObject, hashtable); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } if (!args.Contains("easetype")) { args.Add("easetype", AMTween.EaseType.linear); } if (target.GetComponent(typeof(GUITexture))) { color = (color2 = target.GetComponent().color); } else if (target.GetComponent(typeof(GUIText))) { color = (color2 = target.GetComponent().material.color); } else if (target.GetComponent()) { color = (color2 = target.GetComponent().material.color); } else if (target.GetComponent()) { color = (color2 = target.GetComponent().color); } if (args.Contains("color")) { color = (Color)args["color"]; } else { if (args.Contains("r")) { color.r = (float)args["r"]; } if (args.Contains("g")) { color.g = (float)args["g"]; } if (args.Contains("b")) { color.b = (float)args["b"]; } if (args.Contains("a")) { color.a = (float)args["a"]; } } if (args.Contains("amount")) { color.a = (float)args["amount"]; args.Remove("amount"); } else if (args.Contains("alpha")) { color.a = (float)args["alpha"]; args.Remove("alpha"); } if (target.GetComponent(typeof(GUITexture))) { target.GetComponent().color = color; } else if (target.GetComponent(typeof(GUIText))) { target.GetComponent().material.color = color; } else if (target.GetComponent()) { target.GetComponent().material.color = color; } else if (target.GetComponent()) { target.GetComponent().color = color; } args["color"] = color2; args["type"] = "color"; args["method"] = "to"; AMTween.Launch(target, args); } public static void ColorTo(GameObject target, Color color, float time, string trackId) { AMTween.ColorTo(target, AMTween.Hash(new object[] { "trackid", trackId, "color", color, "time", time })); } public static void ColorTo(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (!args.Contains("includechildren") || (bool)args["includechildren"]) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; Hashtable hashtable = (Hashtable)args.Clone(); hashtable["ischild"] = true; AMTween.ColorTo(transform.gameObject, hashtable); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } if (!args.Contains("easetype")) { args.Add("easetype", AMTween.EaseType.linear); } args["type"] = "color"; args["method"] = "to"; AMTween.Launch(target, args); } public static void AudioFrom(GameObject target, float volume, float pitch, float time, string trackId) { AMTween.AudioFrom(target, AMTween.Hash(new object[] { "trackid", trackId, "volume", volume, "pitch", pitch, "time", time })); } public static void AudioFrom(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); AudioSource audioSource; if (args.Contains("audiosource")) { audioSource = (AudioSource)args["audiosource"]; } else { if (!target.GetComponent(typeof(AudioSource))) { Debug.LogError("AMTween Error: AudioFrom requires an AudioSource."); return; } audioSource = target.GetComponent(); } Vector2 vector; Vector2 vector2; vector.x = (vector2.x = audioSource.volume); vector.y = (vector2.y = audioSource.pitch); if (args.Contains("volume")) { vector2.x = (float)args["volume"]; } if (args.Contains("pitch")) { vector2.y = (float)args["pitch"]; } audioSource.volume = vector2.x; audioSource.pitch = vector2.y; args["volume"] = vector.x; args["pitch"] = vector.y; if (!args.Contains("easetype")) { args.Add("easetype", AMTween.EaseType.linear); } args["type"] = "audio"; args["method"] = "to"; AMTween.Launch(target, args); } public static void AudioTo(GameObject target, float volume, float pitch, float time, string trackId) { AMTween.AudioTo(target, AMTween.Hash(new object[] { "trackid", trackId, "volume", volume, "pitch", pitch, "time", time })); } public static void AudioTo(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (!args.Contains("easetype")) { args.Add("easetype", AMTween.EaseType.linear); } args["type"] = "audio"; args["method"] = "to"; AMTween.Launch(target, args); } public static void Stab(GameObject target, AudioClip audioclip, float delay, string trackId) { AMTween.Stab(target, AMTween.Hash(new object[] { "trackid", trackId, "audioclip", audioclip, "delay", delay })); } public static void Stab(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "stab"; AMTween.Launch(target, args); } public static void LookFrom(GameObject target, Vector3 looktarget, float time, string trackId) { AMTween.LookFrom(target, AMTween.Hash(new object[] { "trackid", trackId, "looktarget", looktarget, "time", time })); } public static void LookFrom(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); Vector3 eulerAngles = target.transform.eulerAngles; if (args["looktarget"].GetType() == typeof(Transform)) { Transform transform = target.transform; Transform target2 = (Transform)args["looktarget"]; Vector3? vector = (Vector3?)args["up"]; transform.LookAt(target2, (vector == null) ? AMTween.Defaults.up : vector.Value); } else if (args["looktarget"].GetType() == typeof(Vector3)) { Transform transform2 = target.transform; Vector3 worldPosition = (Vector3)args["looktarget"]; Vector3? vector2 = (Vector3?)args["up"]; transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value); } if (args.Contains("axis")) { Vector3 eulerAngles2 = target.transform.eulerAngles; string text = (string)args["axis"]; if (text != null) { if (!(text == "x")) { if (!(text == "y")) { if (text == "z") { eulerAngles2.x = eulerAngles.x; eulerAngles2.y = eulerAngles.y; } } else { eulerAngles2.x = eulerAngles.x; eulerAngles2.z = eulerAngles.z; } } else { eulerAngles2.y = eulerAngles.y; eulerAngles2.z = eulerAngles.z; } } target.transform.eulerAngles = eulerAngles2; } args["rotation"] = eulerAngles; args["type"] = "rotate"; args["method"] = "to"; AMTween.Launch(target, args); } public static void LookToFollow(GameObject target, Transform looktarget, float time, string trackId) { AMTween.LookToFollow(target, AMTween.Hash(new object[] { "trackid", trackId, "looktarget", looktarget, "time", time })); } public static void LookToFollow(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["looktarget"]; args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z); args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); } if (args.Contains("endposition") && args["endposition"] == null) { args.Remove("endposition"); } args["type"] = "look"; args["method"] = "tofollow"; AMTween.Launch(target, args); } public static void LookFollow(GameObject target, Transform looktarget, float time, string trackId) { AMTween.LookFollow(target, AMTween.Hash(new object[] { "trackid", trackId, "looktarget", looktarget, "time", time })); } public static void LookFollow(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["looktarget"]; args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z); args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); } args["type"] = "look"; args["method"] = "follow"; AMTween.Launch(target, args); } public static void LookTo(GameObject target, Vector3 looktarget, float time, string trackId) { AMTween.LookTo(target, AMTween.Hash(new object[] { "trackid", trackId, "looktarget", looktarget, "time", time })); } public static void LookTo(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (args.Contains("looktarget") && args["looktarget"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["looktarget"]; args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z); args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); } args["type"] = "look"; args["method"] = "to"; AMTween.Launch(target, args); } public static void SendMessage(GameObject target, string methodName, object parameter, string trackId) { AMTween.SendMessage(target, AMTween.Hash(new object[] { "trackid", trackId, "methodname", methodName, "parameter", parameter })); } public static void SendMessage(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (!args.Contains("methodname")) { Debug.LogError("AMTween Error: SendMessage() requires 'methodname'."); return; } args["type"] = "send"; args["method"] = "message"; AMTween.Launch(target, args); } public static void PlayAnimation(GameObject target, string animation, WrapMode wrapmode, bool crossfade, string trackId) { AMTween.PlayAnimation(target, AMTween.Hash(new object[] { "trackid", trackId, "animation", animation, "crossfade", crossfade, "wrapmode", wrapmode })); } public static void PlayAnimation(GameObject target, Hashtable args) { args["type"] = "play"; args["method"] = "animation"; AMTween.Launch(target, args); } public static void PlayAudio(AudioSource audioSource, AudioClip audioClip, bool loop, string trackId) { AMTween.PlayAudio(audioSource, AMTween.Hash(new object[] { "trackid", trackId, "audiosource", audioSource, "audioclip", audioClip, "loop", loop })); } public static void PlayAudio(AudioSource audioSource, Hashtable args) { args = AMTween.CleanArgs(args); args["audiosource"] = audioSource; args["type"] = "play"; args["method"] = "audio"; if ((bool)args["loop"]) { args["looptype"] = AMTween.LoopType.loop; } AMTween.Launch(audioSource.gameObject, args); } public static void MoveTo(GameObject target, Vector3 position, float time, string trackId) { AMTween.MoveTo(target, AMTween.Hash(new object[] { "trackid", trackId, "position", position, "time", time })); } public static void MoveTo(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (args.Contains("position") && args["position"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["position"]; args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z); args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z); } args["type"] = "move"; args["method"] = "to"; AMTween.Launch(target, args); } public static void MoveFrom(GameObject target, Vector3 position, float time, string trackId) { AMTween.MoveFrom(target, AMTween.Hash(new object[] { "trackid", trackId, "position", position, "time", time })); } public static void MoveFrom(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); bool flag; if (args.Contains("islocal")) { flag = (bool)args["islocal"]; } else { flag = AMTween.Defaults.isLocal; } if (args.Contains("path")) { Vector3[] array2; if (args["path"].GetType() == typeof(Vector3[])) { Vector3[] array = (Vector3[])args["path"]; array2 = new Vector3[array.Length]; Array.Copy(array, array2, array.Length); } else { Transform[] array3 = (Transform[])args["path"]; array2 = new Vector3[array3.Length]; for (int i = 0; i < array3.Length; i++) { array2[i] = array3[i].position; } } if (array2[array2.Length - 1] != target.transform.position) { Vector3[] array4 = new Vector3[array2.Length + 1]; Array.Copy(array2, array4, array2.Length); if (flag) { array4[array4.Length - 1] = target.transform.localPosition; target.transform.localPosition = array4[0]; } else { array4[array4.Length - 1] = target.transform.position; target.transform.position = array4[0]; } args["path"] = array4; } else { if (flag) { target.transform.localPosition = array2[0]; } else { target.transform.position = array2[0]; } args["path"] = array2; } } else { Vector3 vector2; Vector3 vector; if (flag) { vector = (vector2 = target.transform.localPosition); } else { vector = (vector2 = target.transform.position); } if (args.Contains("position")) { if (args["position"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["position"]; vector = transform.position; } else if (args["position"].GetType() == typeof(Vector3)) { vector = (Vector3)args["position"]; } } else { if (args.Contains("x")) { vector.x = (float)args["x"]; } if (args.Contains("y")) { vector.y = (float)args["y"]; } if (args.Contains("z")) { vector.z = (float)args["z"]; } } if (flag) { target.transform.localPosition = vector; } else { target.transform.position = vector; } args["position"] = vector2; } args["type"] = "move"; args["method"] = "to"; AMTween.Launch(target, args); } public static void MoveAdd(GameObject target, Vector3 amount, float time, string trackId) { AMTween.MoveAdd(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void MoveAdd(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "move"; args["method"] = "add"; AMTween.Launch(target, args); } public static void MoveBy(GameObject target, Vector3 amount, float time, string trackId) { AMTween.MoveBy(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void MoveBy(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "move"; args["method"] = "by"; AMTween.Launch(target, args); } public static void ScaleTo(GameObject target, Vector3 scale, float time, string trackId) { AMTween.ScaleTo(target, AMTween.Hash(new object[] { "trackid", trackId, "scale", scale, "time", time })); } public static void ScaleTo(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (args.Contains("scale") && args["scale"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["scale"]; args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z); args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z); } args["type"] = "scale"; args["method"] = "to"; AMTween.Launch(target, args); } public static void ScaleFrom(GameObject target, Vector3 scale, float time, string trackId) { AMTween.ScaleFrom(target, AMTween.Hash(new object[] { "trackid", trackId, "scale", scale, "time", time })); } public static void ScaleFrom(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); Vector3 localScale2; Vector3 localScale = localScale2 = target.transform.localScale; if (args.Contains("scale")) { if (args["scale"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["scale"]; localScale = transform.localScale; } else if (args["scale"].GetType() == typeof(Vector3)) { localScale = (Vector3)args["scale"]; } } else { if (args.Contains("x")) { localScale.x = (float)args["x"]; } if (args.Contains("y")) { localScale.y = (float)args["y"]; } if (args.Contains("z")) { localScale.z = (float)args["z"]; } } target.transform.localScale = localScale; args["scale"] = localScale2; args["type"] = "scale"; args["method"] = "to"; AMTween.Launch(target, args); } public static void ScaleAdd(GameObject target, Vector3 amount, float time, string trackId) { AMTween.ScaleAdd(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void ScaleAdd(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "scale"; args["method"] = "add"; AMTween.Launch(target, args); } public static void ScaleBy(GameObject target, Vector3 amount, float time, string trackId) { AMTween.ScaleBy(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void ScaleBy(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "scale"; args["method"] = "by"; AMTween.Launch(target, args); } public static void RotateTo(GameObject target, Vector3 rotation, float time, string trackId) { AMTween.RotateTo(target, AMTween.Hash(new object[] { "trackid", trackId, "rotation", rotation, "time", time })); } public static void RotateTo(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); if (args.Contains("rotation") && args["rotation"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["rotation"]; args["position"] = new Vector3(transform.position.x, transform.position.y, transform.position.z); args["rotation"] = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); args["scale"] = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z); } args["type"] = "rotate"; args["method"] = "to"; AMTween.Launch(target, args); } public static void RotateFrom(GameObject target, Vector3 rotation, float time, string trackId) { AMTween.RotateFrom(target, AMTween.Hash(new object[] { "trackid", trackId, "rotation", rotation, "time", time })); } public static void RotateFrom(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); bool flag; if (args.Contains("islocal")) { flag = (bool)args["islocal"]; } else { flag = AMTween.Defaults.isLocal; } Vector3 vector2; Vector3 vector; if (flag) { vector = (vector2 = target.transform.localEulerAngles); } else { vector = (vector2 = target.transform.eulerAngles); } if (args.Contains("rotation")) { if (args["rotation"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["rotation"]; vector = transform.eulerAngles; } else if (args["rotation"].GetType() == typeof(Vector3)) { vector = (Vector3)args["rotation"]; } } else { if (args.Contains("x")) { vector.x = (float)args["x"]; } if (args.Contains("y")) { vector.y = (float)args["y"]; } if (args.Contains("z")) { vector.z = (float)args["z"]; } } if (flag) { target.transform.localEulerAngles = vector; } else { target.transform.eulerAngles = vector; } args["rotation"] = vector2; args["type"] = "rotate"; args["method"] = "to"; AMTween.Launch(target, args); } public static void RotateAdd(GameObject target, Vector3 amount, float time, string trackId) { AMTween.RotateAdd(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void RotateAdd(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "rotate"; args["method"] = "add"; AMTween.Launch(target, args); } public static void RotateBy(GameObject target, Vector3 amount, float time, string trackId) { AMTween.RotateBy(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void RotateBy(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "rotate"; args["method"] = "by"; AMTween.Launch(target, args); } public static void ShakePosition(GameObject target, Vector3 amount, float time, string trackId) { AMTween.ShakePosition(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void ShakePosition(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "shake"; args["method"] = "position"; AMTween.Launch(target, args); } public static void ShakeScale(GameObject target, Vector3 amount, float time, string trackId) { AMTween.ShakeScale(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void ShakeScale(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "shake"; args["method"] = "scale"; AMTween.Launch(target, args); } public static void ShakeRotation(GameObject target, Vector3 amount, float time, string trackId) { AMTween.ShakeRotation(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void ShakeRotation(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "shake"; args["method"] = "rotation"; AMTween.Launch(target, args); } public static void PunchPosition(GameObject target, Vector3 amount, float time, string trackId) { AMTween.PunchPosition(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void PunchPosition(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "punch"; args["method"] = "position"; args["easetype"] = AMTween.EaseType.punch; AMTween.Launch(target, args); } public static void PunchRotation(GameObject target, Vector3 amount, float time, string trackId) { AMTween.PunchRotation(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void PunchRotation(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "punch"; args["method"] = "rotation"; args["easetype"] = AMTween.EaseType.punch; AMTween.Launch(target, args); } public static void PunchScale(GameObject target, Vector3 amount, float time, string trackId) { AMTween.PunchScale(target, AMTween.Hash(new object[] { "trackid", trackId, "amount", amount, "time", time })); } public static void PunchScale(GameObject target, Hashtable args) { args = AMTween.CleanArgs(args); args["type"] = "punch"; args["method"] = "scale"; args["easetype"] = AMTween.EaseType.punch; AMTween.Launch(target, args); } private void GenerateTargets() { string text = this.type; switch (text) { case "value": { string text2 = this.method; if (text2 != null) { if (!(text2 == "float")) { if (!(text2 == "vector2")) { if (!(text2 == "vector3")) { if (!(text2 == "color")) { if (text2 == "rect") { this.GenerateRectTargets(); this.apply = new AMTween.ApplyTween(this.ApplyRectTargets); } } else { this.GenerateColorTargets(); this.apply = new AMTween.ApplyTween(this.ApplyColorTargets); } } else { this.GenerateVector3Targets(); this.apply = new AMTween.ApplyTween(this.ApplyVector3Targets); } } else { this.GenerateVector2Targets(); this.apply = new AMTween.ApplyTween(this.ApplyVector2Targets); } } else { this.GenerateFloatTargets(); this.apply = new AMTween.ApplyTween(this.ApplyFloatTargets); } } break; } case "property": { string text3 = this.method; if (text3 != null) { if (!(text3 == "morph")) { if (!(text3 == "float")) { if (!(text3 == "vector2")) { if (!(text3 == "vector3")) { if (!(text3 == "color")) { if (text3 == "rect") { this.GenerateRectTargets(); this.apply = new AMTween.ApplyTween(this.ApplyPropertyRectTargets); } } else { this.GenerateColorTargets(); this.apply = new AMTween.ApplyTween(this.ApplyPropertyColorTargets); } } else { this.GenerateVector3Targets(); this.apply = new AMTween.ApplyTween(this.ApplyPropertyVector3Targets); } } else { this.GenerateVector2Targets(); this.apply = new AMTween.ApplyTween(this.ApplyPropertyVector2Targets); } } else { this.GenerateFloatTargets(); this.apply = new AMTween.ApplyTween(this.ApplyPropertyFloatTargets); } } else { this.GenerateMorphTargets(); this.apply = new AMTween.ApplyTween(this.ApplyPropertyMorphTargets); } } break; } case "color": { string text4 = this.method; if (text4 != null) { if (text4 == "to") { this.GenerateColorToTargets(); this.apply = new AMTween.ApplyTween(this.ApplyColorToTargets); } } break; } case "audio": { string text5 = this.method; if (text5 != null) { if (text5 == "to") { this.GenerateAudioToTargets(); this.apply = new AMTween.ApplyTween(this.ApplyAudioToTargets); } } break; } case "move": { string text6 = this.method; if (text6 != null) { if (!(text6 == "to")) { if (text6 == "by" || text6 == "add") { this.GenerateMoveByTargets(); this.apply = new AMTween.ApplyTween(this.ApplyMoveByTargets); } } else if (this.tweenArguments.Contains("path")) { this.GenerateMoveToPathTargets(); this.apply = new AMTween.ApplyTween(this.ApplyMoveToPathTargets); } else { this.GenerateMoveToTargets(); this.apply = new AMTween.ApplyTween(this.ApplyMoveToTargets); } } break; } case "scale": { string text7 = this.method; if (text7 != null) { if (!(text7 == "to")) { if (!(text7 == "by")) { if (text7 == "add") { this.GenerateScaleAddTargets(); this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets); } } else { this.GenerateScaleByTargets(); this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets); } } else { this.GenerateScaleToTargets(); this.apply = new AMTween.ApplyTween(this.ApplyScaleToTargets); } } break; } case "rotate": { string text8 = this.method; if (text8 != null) { if (!(text8 == "to")) { if (!(text8 == "add")) { if (text8 == "by") { this.GenerateRotateByTargets(); this.apply = new AMTween.ApplyTween(this.ApplyRotateAddTargets); } } else { this.GenerateRotateAddTargets(); this.apply = new AMTween.ApplyTween(this.ApplyRotateAddTargets); } } else { this.GenerateRotateToTargets(); this.apply = new AMTween.ApplyTween(this.ApplyRotateToTargets); } } break; } case "shake": { string text9 = this.method; if (text9 != null) { if (!(text9 == "position")) { if (!(text9 == "scale")) { if (text9 == "rotation") { this.GenerateShakeRotationTargets(); this.apply = new AMTween.ApplyTween(this.ApplyShakeRotationTargets); } } else { this.GenerateShakeScaleTargets(); this.apply = new AMTween.ApplyTween(this.ApplyShakeScaleTargets); } } else { this.GenerateShakePositionTargets(); this.apply = new AMTween.ApplyTween(this.ApplyShakePositionTargets); } } break; } case "punch": { string text10 = this.method; if (text10 != null) { if (!(text10 == "position")) { if (!(text10 == "rotation")) { if (text10 == "scale") { this.GeneratePunchScaleTargets(); this.apply = new AMTween.ApplyTween(this.ApplyPunchScaleTargets); } } else { this.GeneratePunchRotationTargets(); this.apply = new AMTween.ApplyTween(this.ApplyPunchRotationTargets); } } else { this.GeneratePunchPositionTargets(); this.apply = new AMTween.ApplyTween(this.ApplyPunchPositionTargets); } } break; } case "look": { string text11 = this.method; if (text11 != null) { if (!(text11 == "to")) { if (!(text11 == "follow")) { if (text11 == "tofollow") { this.GenerateLookToFollowTargets(); this.apply = new AMTween.ApplyTween(this.ApplyLookToFollowTargets); } } else { this.apply = new AMTween.ApplyTween(this.ApplyLookFollowTargets); } } else { this.GenerateLookToTargets(); this.apply = new AMTween.ApplyTween(this.ApplyLookToTargets); } } break; } case "stab": this.GenerateStabTargets(); this.apply = new AMTween.ApplyTween(this.ApplyStabTargets); break; case "play": { string text12 = this.method; if (text12 != null) { if (!(text12 == "audio")) { if (text12 == "animation") { this.GeneratePlayAnimationTargets(); } } else { this.GeneratePlayAudioTargets(); } } break; } case "camerafade": if ((int)this.tweenArguments["camerafadetype"] == 5) { this.GenerateCameraFadeNoneTargets(); } else { this.GenerateCameraFadeTargets(); this.apply = new AMTween.ApplyTween(this.ApplyCameraFadeValueTargets); } break; } } private void GenerateCameraFadeNoneTargets() { if (this.tweenArguments.Contains("camera2")) { AMTween.SetTopCamera((Camera)this.tweenArguments["camera2"], (Camera[])this.tweenArguments["allcameras"]); } else if (this.tweenArguments.Contains("color2")) { AMTween.ShowColor((Color)this.tweenArguments["color2"]); } this.Dispose(); } private void GenerateCameraFadeTargets() { if (AMTween.cf.keepAliveColor) { AMTween.cf.keepAliveColor = false; } AMTween.cf.isReset = false; bool flag = (bool)this.tweenArguments["reversed"]; Camera camera = null; Camera camera2 = null; Color? color = null; Color? color2 = null; if (!flag) { if (this.tweenArguments.Contains("camera1")) { camera = (Camera)this.tweenArguments["camera1"]; } else if (this.tweenArguments.Contains("color1")) { color = new Color?((Color)this.tweenArguments["color1"]); } if (this.tweenArguments.Contains("camera2")) { camera2 = (Camera)this.tweenArguments["camera2"]; } else if (this.tweenArguments.Contains("color2")) { color2 = new Color?((Color)this.tweenArguments["color2"]); } } else { if (this.tweenArguments.Contains("camera2")) { camera = (Camera)this.tweenArguments["camera2"]; } else if (this.tweenArguments.Contains("color2")) { color = new Color?((Color)this.tweenArguments["color2"]); } if (this.tweenArguments.Contains("camera1")) { camera2 = (Camera)this.tweenArguments["camera1"]; } else if (this.tweenArguments.Contains("color1")) { color2 = new Color?((Color)this.tweenArguments["color1"]); } } if (camera) { if ((bool)this.tweenArguments["userendertex"]) { AMTween.cf.setupRenderTexture(camera); } else { AMTween.SetTopCamera(camera, (Camera[])this.tweenArguments["allcameras"]); camera.Render(); AMTween.cf.clearTexture2D(); AMTween.cf.tex2d = AMTween.GetScreenTexture(); AMTween.cf.useRenderTexture = false; AMTween.cf.hasColorTex = false; } } else { AMTween.cf.colorTex = color.Value; AMTween.cf.hasColorTex = true; } if (camera2) { AMTween.SetTopCamera(camera2, (Camera[])this.tweenArguments["allcameras"]); AMTween.cf.hasColorBG = false; } else { AMTween.cf.colorBG = color2.Value; AMTween.cf.hasColorBG = true; } if (this.tweenArguments.Contains("texture")) { AMTween.cf.irisShape = (Texture2D)this.tweenArguments["texture"]; } AMTween.cf.mode = (int)this.tweenArguments["camerafadetype"]; AMTween.cf.setupMaterials(); AMTween.cf.r = (float[])this.tweenArguments["parameters"]; AMTween.cf.value = 1f; AMTween.cf.percent = 0f; } private void GeneratePlayAnimationTargets() { if ((WrapMode)this.tweenArguments["wrapmode"] != WrapMode.Once) { this.time = float.PositiveInfinity; } else { this.time = (this.tweenArguments["target"] as GameObject).GetComponent().GetClip((string)this.tweenArguments["animation"]).length; } } private void GeneratePlayAudioTargets() { if ((bool)this.tweenArguments["loop"]) { this.time = float.PositiveInfinity; } else { this.time = (this.tweenArguments["audioclip"] as AudioClip).length - this.runningTime; } } private void GenerateMorphTargets() { this.startMorphs = (float[])this.tweenArguments["from"]; this.endMorphs = (float[])this.tweenArguments["to"]; this.currentMorphs = new float[this.startMorphs.Length]; for (int i = 0; i < this.startMorphs.Length; i++) { this.currentMorphs[i] = this.startMorphs[i]; } if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(this.floats[0] - this.floats[1]); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateRectTargets() { this.rects = new Rect[3]; this.rects[0] = (Rect)this.tweenArguments["from"]; this.rects[1] = (Rect)this.tweenArguments["to"]; } private void GenerateColorTargets() { this.colors = new Color[1, 3]; this.colors[0, 0] = (Color)this.tweenArguments["from"]; this.colors[0, 1] = (Color)this.tweenArguments["to"]; } private void GenerateVector3Targets() { this.vector3s = new Vector3[3]; this.vector3s[0] = (Vector3)this.tweenArguments["from"]; this.vector3s[1] = (Vector3)this.tweenArguments["to"]; if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateVector2Targets() { this.vector2s = new Vector2[3]; this.vector2s[0] = (Vector2)this.tweenArguments["from"]; this.vector2s[1] = (Vector2)this.tweenArguments["to"]; if (this.tweenArguments.Contains("speed")) { Vector3 a = new Vector3(this.vector2s[0].x, this.vector2s[0].y, 0f); Vector3 b = new Vector3(this.vector2s[1].x, this.vector2s[1].y, 0f); float num = Math.Abs(Vector3.Distance(a, b)); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateFloatTargets() { this.floats = new float[3]; this.floats[0] = (float)this.tweenArguments["from"]; this.floats[1] = (float)this.tweenArguments["to"]; if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(this.floats[0] - this.floats[1]); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateColorToTargets() { if (base.GetComponent(typeof(GUITexture))) { this.colors = new Color[1, 3]; this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent().color); } else if (base.GetComponent(typeof(GUIText))) { this.colors = new Color[1, 3]; this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent().material.color); } else if (base.GetComponent()) { Renderer component = base.GetComponent(); this.colors = new Color[component.materials.Length, 3]; for (int i = 0; i < component.materials.Length; i++) { this.colors[i, 0] = component.materials[i].GetColor(this.namedcolorvalue.ToString()); this.colors[i, 1] = component.materials[i].GetColor(this.namedcolorvalue.ToString()); } } else if (base.GetComponent()) { this.colors = new Color[1, 3]; this.colors[0, 0] = (this.colors[0, 1] = base.GetComponent().color); } else { this.colors = new Color[1, 3]; } if (this.tweenArguments.Contains("color")) { for (int j = 0; j < this.colors.GetLength(0); j++) { this.colors[j, 1] = (Color)this.tweenArguments["color"]; } } else { if (this.tweenArguments.Contains("r")) { for (int k = 0; k < this.colors.GetLength(0); k++) { this.colors[k, 1].r = (float)this.tweenArguments["r"]; } } if (this.tweenArguments.Contains("g")) { for (int l = 0; l < this.colors.GetLength(0); l++) { this.colors[l, 1].g = (float)this.tweenArguments["g"]; } } if (this.tweenArguments.Contains("b")) { for (int m = 0; m < this.colors.GetLength(0); m++) { this.colors[m, 1].b = (float)this.tweenArguments["b"]; } } if (this.tweenArguments.Contains("a")) { for (int n = 0; n < this.colors.GetLength(0); n++) { this.colors[n, 1].a = (float)this.tweenArguments["a"]; } } } if (this.tweenArguments.Contains("amount")) { for (int num = 0; num < this.colors.GetLength(0); num++) { this.colors[num, 1].a = (float)this.tweenArguments["amount"]; } } else if (this.tweenArguments.Contains("alpha")) { for (int num2 = 0; num2 < this.colors.GetLength(0); num2++) { this.colors[num2, 1].a = (float)this.tweenArguments["alpha"]; } } } private void GenerateAudioToTargets() { this.vector2s = new Vector2[3]; if (this.tweenArguments.Contains("audiosource")) { this.audioSource = (AudioSource)this.tweenArguments["audiosource"]; } else if (base.GetComponent(typeof(AudioSource))) { this.audioSource = base.GetComponent(); } else { Debug.LogError("AMTween Error: AudioTo requires an AudioSource."); this.Dispose(); } this.vector2s[0] = (this.vector2s[1] = new Vector2(this.audioSource.volume, this.audioSource.pitch)); if (this.tweenArguments.Contains("volume")) { this.vector2s[1].x = (float)this.tweenArguments["volume"]; } if (this.tweenArguments.Contains("pitch")) { this.vector2s[1].y = (float)this.tweenArguments["pitch"]; } } private void GenerateStabTargets() { if (this.tweenArguments.Contains("audiosource")) { this.audioSource = (AudioSource)this.tweenArguments["audiosource"]; } else if (base.GetComponent(typeof(AudioSource))) { this.audioSource = base.GetComponent(); } else { base.gameObject.AddComponent(typeof(AudioSource)); this.audioSource = base.GetComponent(); this.audioSource.playOnAwake = false; } this.audioSource.clip = (AudioClip)this.tweenArguments["audioclip"]; if (this.tweenArguments.Contains("pitch")) { this.audioSource.pitch = (float)this.tweenArguments["pitch"]; } if (this.tweenArguments.Contains("volume")) { this.audioSource.volume = (float)this.tweenArguments["volume"]; } this.time = this.audioSource.clip.length / this.audioSource.pitch; } private void GenerateLookToFollowTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = base.transform.eulerAngles; if (!this.tweenArguments.Contains("looktarget") && !this.tweenArguments.Contains("targetrotation")) { Debug.LogError("AMTween Error: LookTo needs a 'looktarget' pr 'targetrotation' property!"); this.Dispose(); } } private void GenerateLookToTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = base.transform.eulerAngles; if (this.tweenArguments.Contains("looktarget")) { if (this.tweenArguments["looktarget"].GetType() == typeof(Transform)) { Transform transform = base.transform; Transform target = (Transform)this.tweenArguments["looktarget"]; Vector3? vector = (Vector3?)this.tweenArguments["up"]; transform.LookAt(target, (vector == null) ? AMTween.Defaults.up : vector.Value); } else if (this.tweenArguments["looktarget"].GetType() == typeof(Vector3)) { Transform transform2 = base.transform; Vector3 worldPosition = (Vector3)this.tweenArguments["looktarget"]; Vector3? vector2 = (Vector3?)this.tweenArguments["up"]; transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value); } } else { Debug.LogError("AMTween Error: LookTo needs a 'looktarget' property!"); this.Dispose(); } this.vector3s[1] = base.transform.eulerAngles; base.transform.eulerAngles = this.vector3s[0]; if (this.tweenArguments.Contains("axis")) { string text = (string)this.tweenArguments["axis"]; if (text != null) { if (!(text == "x")) { if (!(text == "y")) { if (text == "z") { this.vector3s[1].x = this.vector3s[0].x; this.vector3s[1].y = this.vector3s[0].y; } } else { this.vector3s[1].x = this.vector3s[0].x; this.vector3s[1].z = this.vector3s[0].z; } } else { this.vector3s[1].y = this.vector3s[0].y; this.vector3s[1].z = this.vector3s[0].z; } } } this.vector3s[1] = new Vector3(AMTween.clerp(this.vector3s[0].x, this.vector3s[1].x, 1f), AMTween.clerp(this.vector3s[0].y, this.vector3s[1].y, 1f), AMTween.clerp(this.vector3s[0].z, this.vector3s[1].z, 1f)); if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateMoveToPathTargets() { Vector3[] array2; if (this.tweenArguments["path"].GetType() == typeof(Vector3[])) { Vector3[] array = (Vector3[])this.tweenArguments["path"]; if (array.Length == 1) { Debug.LogError("AMTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); this.Dispose(); } array2 = new Vector3[array.Length]; Array.Copy(array, array2, array.Length); } else { Transform[] array3 = (Transform[])this.tweenArguments["path"]; if (array3.Length == 1) { Debug.LogError("AMTween Error: Attempting a path movement with MoveTo requires an array of more than 1 entry!"); this.Dispose(); } array2 = new Vector3[array3.Length]; for (int i = 0; i < array3.Length; i++) { array2[i] = array3[i].position; } } bool flag; int num; if (base.transform.position != array2[0]) { if (!this.tweenArguments.Contains("movetopath") || (bool)this.tweenArguments["movetopath"]) { flag = true; num = 3; } else { flag = false; num = 2; } } else { flag = false; num = 2; } this.vector3s = new Vector3[array2.Length + num]; if (flag) { this.vector3s[1] = base.transform.position; num = 2; } else { num = 1; } Array.Copy(array2, 0, this.vector3s, num, array2.Length); this.vector3s[0] = this.vector3s[1] + (this.vector3s[1] - this.vector3s[2]); this.vector3s[this.vector3s.Length - 1] = this.vector3s[this.vector3s.Length - 2] + (this.vector3s[this.vector3s.Length - 2] - this.vector3s[this.vector3s.Length - 3]); if (this.vector3s[1] == this.vector3s[this.vector3s.Length - 2]) { Vector3[] array4 = new Vector3[this.vector3s.Length]; Array.Copy(this.vector3s, array4, this.vector3s.Length); array4[0] = array4[array4.Length - 3]; array4[array4.Length - 1] = array4[2]; this.vector3s = new Vector3[array4.Length]; Array.Copy(array4, this.vector3s, array4.Length); } this.path = new AMTween.CRSpline(this.vector3s); if (this.tweenArguments.Contains("speed")) { float num2 = AMTween.PathLength(this.vector3s); this.time = num2 / (float)this.tweenArguments["speed"]; } } private void GenerateMoveToTargets() { this.vector3s = new Vector3[3]; if (this.isLocal) { this.vector3s[0] = (this.vector3s[1] = base.transform.localPosition); } else { this.vector3s[0] = (this.vector3s[1] = base.transform.position); } if (this.tweenArguments.Contains("position")) { if (this.tweenArguments["position"].GetType() == typeof(Transform)) { Transform transform = (Transform)this.tweenArguments["position"]; this.vector3s[1] = transform.position; } else if (this.tweenArguments["position"].GetType() == typeof(Vector3)) { this.vector3s[1] = (Vector3)this.tweenArguments["position"]; } } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"]) { this.tweenArguments["looktarget"] = this.vector3s[1]; } if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateMoveByTargets() { this.vector3s = new Vector3[6]; this.vector3s[4] = base.transform.eulerAngles; this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.position)); if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = this.vector3s[0] + (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = this.vector3s[0].x + (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = this.vector3s[0].y + (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = this.vector3s[0].z + (float)this.tweenArguments["z"]; } } base.transform.Translate(this.vector3s[1], this.space); this.vector3s[5] = base.transform.position; base.transform.position = this.vector3s[0]; if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"]) { this.tweenArguments["looktarget"] = this.vector3s[1]; } if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateScaleToTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = (this.vector3s[1] = base.transform.localScale); if (this.tweenArguments.Contains("scale")) { if (this.tweenArguments["scale"].GetType() == typeof(Transform)) { Transform transform = (Transform)this.tweenArguments["scale"]; this.vector3s[1] = transform.localScale; } else if (this.tweenArguments["scale"].GetType() == typeof(Vector3)) { this.vector3s[1] = (Vector3)this.tweenArguments["scale"]; } } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateScaleByTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = (this.vector3s[1] = base.transform.localScale); if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = Vector3.Scale(this.vector3s[1], (Vector3)this.tweenArguments["amount"]); } else { if (this.tweenArguments.Contains("x")) { Vector3[] array = this.vector3s; int num = 1; array[num].x = array[num].x * (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { Vector3[] array2 = this.vector3s; int num2 = 1; array2[num2].y = array2[num2].y * (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { Vector3[] array3 = this.vector3s; int num3 = 1; array3[num3].z = array3[num3].z * (float)this.tweenArguments["z"]; } } if (this.tweenArguments.Contains("speed")) { float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num4 / (float)this.tweenArguments["speed"]; } } private void GenerateScaleAddTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = (this.vector3s[1] = base.transform.localScale); if (this.tweenArguments.Contains("amount")) { this.vector3s[1] += (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { Vector3[] array = this.vector3s; int num = 1; array[num].x = array[num].x + (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { Vector3[] array2 = this.vector3s; int num2 = 1; array2[num2].y = array2[num2].y + (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { Vector3[] array3 = this.vector3s; int num3 = 1; array3[num3].z = array3[num3].z + (float)this.tweenArguments["z"]; } } if (this.tweenArguments.Contains("speed")) { float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num4 / (float)this.tweenArguments["speed"]; } } private void GenerateRotateToTargets() { this.vector3s = new Vector3[3]; if (this.isLocal) { this.vector3s[0] = (this.vector3s[1] = base.transform.localEulerAngles); } else { this.vector3s[0] = (this.vector3s[1] = base.transform.eulerAngles); } if (this.tweenArguments.Contains("rotation")) { if (this.tweenArguments["rotation"].GetType() == typeof(Transform)) { Transform transform = (Transform)this.tweenArguments["rotation"]; this.vector3s[1] = transform.eulerAngles; } else if (this.tweenArguments["rotation"].GetType() == typeof(Vector3)) { this.vector3s[1] = (Vector3)this.tweenArguments["rotation"]; } } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } this.vector3s[1] = new Vector3(AMTween.clerp(this.vector3s[0].x, this.vector3s[1].x, 1f), AMTween.clerp(this.vector3s[0].y, this.vector3s[1].y, 1f), AMTween.clerp(this.vector3s[0].z, this.vector3s[1].z, 1f)); if (this.tweenArguments.Contains("speed")) { float num = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num / (float)this.tweenArguments["speed"]; } } private void GenerateRotateAddTargets() { this.vector3s = new Vector3[5]; this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.eulerAngles)); if (this.tweenArguments.Contains("amount")) { this.vector3s[1] += (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { Vector3[] array = this.vector3s; int num = 1; array[num].x = array[num].x + (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { Vector3[] array2 = this.vector3s; int num2 = 1; array2[num2].y = array2[num2].y + (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { Vector3[] array3 = this.vector3s; int num3 = 1; array3[num3].z = array3[num3].z + (float)this.tweenArguments["z"]; } } if (this.tweenArguments.Contains("speed")) { float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num4 / (float)this.tweenArguments["speed"]; } } private void GenerateRotateByTargets() { this.vector3s = new Vector3[4]; this.vector3s[0] = (this.vector3s[1] = (this.vector3s[3] = base.transform.eulerAngles)); if (this.tweenArguments.Contains("amount")) { this.vector3s[1] += Vector3.Scale((Vector3)this.tweenArguments["amount"], new Vector3(360f, 360f, 360f)); } else { if (this.tweenArguments.Contains("x")) { Vector3[] array = this.vector3s; int num = 1; array[num].x = array[num].x + 360f * (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { Vector3[] array2 = this.vector3s; int num2 = 1; array2[num2].y = array2[num2].y + 360f * (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { Vector3[] array3 = this.vector3s; int num3 = 1; array3[num3].z = array3[num3].z + 360f * (float)this.tweenArguments["z"]; } } if (this.tweenArguments.Contains("speed")) { float num4 = Math.Abs(Vector3.Distance(this.vector3s[0], this.vector3s[1])); this.time = num4 / (float)this.tweenArguments["speed"]; } } private void GenerateShakePositionTargets() { this.vector3s = new Vector3[4]; this.vector3s[3] = base.transform.eulerAngles; this.vector3s[0] = base.transform.position; if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } } private void GenerateShakeScaleTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = base.transform.localScale; if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } } private void GenerateShakeRotationTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = base.transform.eulerAngles; if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } } private void GeneratePunchPositionTargets() { this.vector3s = new Vector3[5]; this.vector3s[4] = base.transform.eulerAngles; this.vector3s[0] = base.transform.position; this.vector3s[1] = (this.vector3s[3] = Vector3.zero); if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } } private void GeneratePunchRotationTargets() { this.vector3s = new Vector3[4]; this.vector3s[0] = base.transform.eulerAngles; this.vector3s[1] = (this.vector3s[3] = Vector3.zero); if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } } private void GeneratePunchScaleTargets() { this.vector3s = new Vector3[3]; this.vector3s[0] = base.transform.localScale; this.vector3s[1] = Vector3.zero; if (this.tweenArguments.Contains("amount")) { this.vector3s[1] = (Vector3)this.tweenArguments["amount"]; } else { if (this.tweenArguments.Contains("x")) { this.vector3s[1].x = (float)this.tweenArguments["x"]; } if (this.tweenArguments.Contains("y")) { this.vector3s[1].y = (float)this.tweenArguments["y"]; } if (this.tweenArguments.Contains("z")) { this.vector3s[1].z = (float)this.tweenArguments["z"]; } } } private void ApplyPropertyMorphTargets() { float[] array = new float[this.startMorphs.Length]; for (int i = 0; i < array.Length; i++) { if (this.endMorphs.Length > i && this.startMorphs[i] != this.endMorphs[i]) { array[i] = this.ease(this.startMorphs[i], this.endMorphs[i], this.percentage, this.easeCurve); (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, new object[] { i, array[i] }); } } if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.endMorphs; } } private void ApplyRectTargets() { this.rects[2].x = this.ease(this.rects[0].x, this.rects[1].x, this.percentage, this.easeCurve); this.rects[2].y = this.ease(this.rects[0].y, this.rects[1].y, this.percentage, this.easeCurve); this.rects[2].width = this.ease(this.rects[0].width, this.rects[1].width, this.percentage, this.easeCurve); this.rects[2].height = this.ease(this.rects[0].height, this.rects[1].height, this.percentage, this.easeCurve); this.tweenArguments["onupdateparams"] = this.rects[2]; if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.rects[1]; } } private void ApplyPropertyRectTargets() { this.rects[2].x = this.ease(this.rects[0].x, this.rects[1].x, this.percentage, this.easeCurve); this.rects[2].y = this.ease(this.rects[0].y, this.rects[1].y, this.percentage, this.easeCurve); this.rects[2].width = this.ease(this.rects[0].width, this.rects[1].width, this.percentage, this.easeCurve); this.rects[2].height = this.ease(this.rects[0].height, this.rects[1].height, this.percentage, this.easeCurve); if (this.tweenArguments["fieldinfo"] != null) { (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.rects[2]); } else if (this.tweenArguments["propertyinfo"] != null) { (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.rects[2], null); } if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.rects[1]; } } private void ApplyColorTargets() { this.colors[0, 2].r = this.ease(this.colors[0, 0].r, this.colors[0, 1].r, this.percentage, this.easeCurve); this.colors[0, 2].g = this.ease(this.colors[0, 0].g, this.colors[0, 1].g, this.percentage, this.easeCurve); this.colors[0, 2].b = this.ease(this.colors[0, 0].b, this.colors[0, 1].b, this.percentage, this.easeCurve); this.colors[0, 2].a = this.ease(this.colors[0, 0].a, this.colors[0, 1].a, this.percentage, this.easeCurve); this.tweenArguments["onupdateparams"] = this.colors[0, 2]; if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.colors[0, 1]; } } private void ApplyPropertyColorTargets() { this.colors[0, 2].r = this.ease(this.colors[0, 0].r, this.colors[0, 1].r, this.percentage, this.easeCurve); this.colors[0, 2].g = this.ease(this.colors[0, 0].g, this.colors[0, 1].g, this.percentage, this.easeCurve); this.colors[0, 2].b = this.ease(this.colors[0, 0].b, this.colors[0, 1].b, this.percentage, this.easeCurve); this.colors[0, 2].a = this.ease(this.colors[0, 0].a, this.colors[0, 1].a, this.percentage, this.easeCurve); if (this.tweenArguments["fieldinfo"] != null) { (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.colors[0, 2]); } else if (this.tweenArguments["propertyinfo"] != null) { (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.colors[0, 2], null); } if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.colors[0, 1]; } } private void ApplyVector3Targets() { this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); this.tweenArguments["onupdateparams"] = this.vector3s[2]; if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.vector3s[1]; } } private void ApplyPropertyVector3Targets() { this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); if (this.tweenArguments["fieldinfo"] != null) { (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.vector3s[2]); } else if (this.tweenArguments["propertyinfo"] != null) { (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.vector3s[2], null); } if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.vector3s[1]; } } private void ApplyVector2Targets() { this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve); this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve); this.tweenArguments["onupdateparams"] = this.vector2s[2]; if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.vector2s[1]; } } private void ApplyPropertyVector2Targets() { this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve); this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve); if (this.tweenArguments["fieldinfo"] != null) { (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.vector2s[2]); } else if (this.tweenArguments["propertyinfo"] != null) { (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.vector2s[2], null); } if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.vector2s[1]; } } private void ApplyFloatTargets() { this.floats[2] = this.ease(this.floats[0], this.floats[1], this.percentage, this.easeCurve); this.tweenArguments["onupdateparams"] = this.floats[2]; if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.floats[1]; } } private void ApplyPropertyFloatTargets() { this.floats[2] = this.ease(this.floats[0], this.floats[1], this.percentage, this.easeCurve); if (this.tweenArguments["fieldinfo"] != null) { if ((this.tweenArguments["fieldinfo"] as FieldInfo).FieldType == typeof(int)) { (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, (int)this.floats[2]); } else { (this.tweenArguments["fieldinfo"] as FieldInfo).SetValue(this.tweenArguments["component"] as Component, this.floats[2]); } } else if (this.tweenArguments["propertyinfo"] != null) { if ((this.tweenArguments["propertyinfo"] as PropertyInfo).PropertyType == typeof(int)) { (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, (int)this.floats[2], null); } else { (this.tweenArguments["propertyinfo"] as PropertyInfo).SetValue(this.tweenArguments["component"] as Component, this.floats[2], null); } } if (this.percentage == 1f) { this.tweenArguments["onupdateparams"] = this.floats[1]; } } private void ApplyColorToTargets() { for (int i = 0; i < this.colors.GetLength(0); i++) { this.colors[i, 2].r = this.ease(this.colors[i, 0].r, this.colors[i, 1].r, this.percentage, this.easeCurve); this.colors[i, 2].g = this.ease(this.colors[i, 0].g, this.colors[i, 1].g, this.percentage, this.easeCurve); this.colors[i, 2].b = this.ease(this.colors[i, 0].b, this.colors[i, 1].b, this.percentage, this.easeCurve); this.colors[i, 2].a = this.ease(this.colors[i, 0].a, this.colors[i, 1].a, this.percentage, this.easeCurve); } if (base.GetComponent(typeof(GUITexture))) { base.GetComponent().color = this.colors[0, 2]; } else if (base.GetComponent(typeof(GUIText))) { base.GetComponent().material.color = this.colors[0, 2]; } else if (base.GetComponent()) { Renderer component = base.GetComponent(); for (int j = 0; j < this.colors.GetLength(0); j++) { component.materials[j].SetColor(this.namedcolorvalue.ToString(), this.colors[j, 2]); } } else if (base.GetComponent()) { base.GetComponent().color = this.colors[0, 2]; } if (this.percentage == 1f) { if (base.GetComponent(typeof(GUITexture))) { base.GetComponent().color = this.colors[0, 1]; } else if (base.GetComponent(typeof(GUIText))) { base.GetComponent().material.color = this.colors[0, 1]; } else if (base.GetComponent()) { Renderer component2 = base.GetComponent(); for (int k = 0; k < this.colors.GetLength(0); k++) { component2.materials[k].SetColor(this.namedcolorvalue.ToString(), this.colors[k, 1]); } } else if (base.GetComponent()) { base.GetComponent().color = this.colors[0, 1]; } } } private void ApplyAudioToTargets() { this.vector2s[2].x = this.ease(this.vector2s[0].x, this.vector2s[1].x, this.percentage, this.easeCurve); this.vector2s[2].y = this.ease(this.vector2s[0].y, this.vector2s[1].y, this.percentage, this.easeCurve); this.audioSource.volume = this.vector2s[2].x; this.audioSource.pitch = this.vector2s[2].y; if (this.percentage == 1f) { this.audioSource.volume = this.vector2s[1].x; this.audioSource.pitch = this.vector2s[1].y; } } private void ApplyStabTargets() { } private void ApplyMoveToPathTargets() { this.preUpdate = base.transform.position; float value = this.ease(0f, 1f, this.percentage, this.easeCurve); if (this.isLocal) { base.transform.localPosition = this.path.Interp(Mathf.Clamp(value, 0f, 1f)); } else { base.transform.position = this.path.Interp(Mathf.Clamp(value, 0f, 1f)); } if (this.tweenArguments.Contains("orienttopath") && (bool)this.tweenArguments["orienttopath"]) { float num; if (this.tweenArguments.Contains("lookahead")) { num = (float)this.tweenArguments["lookahead"]; } else { num = AMTween.Defaults.lookAhead; } float value2 = this.ease(0f, 1f, Mathf.Min(1f, this.percentage + num), this.easeCurve); this.tweenArguments["looktarget"] = this.path.Interp(Mathf.Clamp(value2, 0f, 1f)); } this.postUpdate = base.transform.position; if (this.physics) { base.transform.position = this.preUpdate; base.GetComponent().MovePosition(this.postUpdate); } } private void ApplyMoveToTargets() { this.preUpdate = base.transform.position; this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); if (this.isLocal) { base.transform.localPosition = this.vector3s[2]; } else { base.transform.position = this.vector3s[2]; } if (this.percentage == 1f) { if (this.isLocal) { base.transform.localPosition = this.vector3s[1]; } else { base.transform.position = this.vector3s[1]; } } this.postUpdate = base.transform.position; if (this.physics) { base.transform.position = this.preUpdate; base.GetComponent().MovePosition(this.postUpdate); } } private void ApplyMoveByTargets() { this.preUpdate = base.transform.position; Vector3 eulerAngles = default(Vector3); if (this.tweenArguments.Contains("looktarget")) { eulerAngles = base.transform.eulerAngles; base.transform.eulerAngles = this.vector3s[4]; } this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); base.transform.Translate(this.vector3s[2] - this.vector3s[3], this.space); this.vector3s[3] = this.vector3s[2]; if (this.tweenArguments.Contains("looktarget")) { base.transform.eulerAngles = eulerAngles; } this.postUpdate = base.transform.position; if (this.physics) { base.transform.position = this.preUpdate; base.GetComponent().MovePosition(this.postUpdate); } } private void ApplyScaleToTargets() { this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); base.transform.localScale = this.vector3s[2]; if (this.percentage == 1f) { base.transform.localScale = this.vector3s[1]; } } private void ApplyLookToTargets() { this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); if (this.isLocal) { base.transform.localRotation = Quaternion.Euler(this.vector3s[2]); } else { base.transform.rotation = Quaternion.Euler(this.vector3s[2]); } } private void ApplyLookToFollowTargets() { if (this.tweenArguments.Contains("endposition")) { Vector3 position = base.transform.position; base.transform.position = (Vector3)this.tweenArguments["endposition"]; base.transform.LookAt((Transform)this.tweenArguments["looktarget"]); base.transform.position = position; } else { base.transform.LookAt((Transform)this.tweenArguments["looktarget"]); } this.vector3s[1] = base.transform.eulerAngles; this.vector3s[1] = new Vector3(AMTween.clerp(this.vector3s[0].x, this.vector3s[1].x, 1f), AMTween.clerp(this.vector3s[0].y, this.vector3s[1].y, 1f), AMTween.clerp(this.vector3s[0].z, this.vector3s[1].z, 1f)); this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); base.transform.rotation = Quaternion.Euler(this.vector3s[2]); } private void ApplyLookFollowTargets() { base.transform.LookAt((Transform)this.tweenArguments["looktarget"]); } private void ApplyRotateToTargets() { this.preUpdate = base.transform.eulerAngles; this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); if (this.isLocal) { base.transform.localRotation = Quaternion.Euler(this.vector3s[2]); } else { base.transform.rotation = Quaternion.Euler(this.vector3s[2]); } if (this.percentage == 1f) { if (this.isLocal) { base.transform.localRotation = Quaternion.Euler(this.vector3s[1]); } else { base.transform.rotation = Quaternion.Euler(this.vector3s[1]); } } this.postUpdate = base.transform.eulerAngles; if (this.physics) { base.transform.eulerAngles = this.preUpdate; base.GetComponent().MoveRotation(Quaternion.Euler(this.postUpdate)); } } private void ApplyRotateAddTargets() { this.preUpdate = base.transform.eulerAngles; this.vector3s[2].x = this.ease(this.vector3s[0].x, this.vector3s[1].x, this.percentage, this.easeCurve); this.vector3s[2].y = this.ease(this.vector3s[0].y, this.vector3s[1].y, this.percentage, this.easeCurve); this.vector3s[2].z = this.ease(this.vector3s[0].z, this.vector3s[1].z, this.percentage, this.easeCurve); base.transform.Rotate(this.vector3s[2] - this.vector3s[3], this.space); this.vector3s[3] = this.vector3s[2]; this.postUpdate = base.transform.eulerAngles; if (this.physics) { base.transform.eulerAngles = this.preUpdate; base.GetComponent().MoveRotation(Quaternion.Euler(this.postUpdate)); } } private void ApplyShakePositionTargets() { if (this.isLocal) { this.preUpdate = base.transform.localPosition; } else { this.preUpdate = base.transform.position; } Vector3 eulerAngles = default(Vector3); if (this.tweenArguments.Contains("looktarget")) { eulerAngles = base.transform.eulerAngles; base.transform.eulerAngles = this.vector3s[3]; } if (this.percentage == 0f) { base.transform.Translate(this.vector3s[1], this.space); } if (this.isLocal) { base.transform.localPosition = this.vector3s[0]; } else { base.transform.position = this.vector3s[0]; } float num = 1f - this.percentage; this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num); this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num); this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num); if (this.isLocal) { base.transform.localPosition += this.vector3s[2]; } else { base.transform.position += this.vector3s[2]; } if (this.tweenArguments.Contains("looktarget")) { base.transform.eulerAngles = eulerAngles; } this.postUpdate = base.transform.position; if (this.physics) { base.transform.position = this.preUpdate; base.GetComponent().MovePosition(this.postUpdate); } } private void ApplyShakeScaleTargets() { if (this.percentage == 0f) { base.transform.localScale = this.vector3s[1]; } base.transform.localScale = this.vector3s[0]; float num = 1f - this.percentage; this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num); this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num); this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num); base.transform.localScale += this.vector3s[2]; } private void ApplyShakeRotationTargets() { this.preUpdate = base.transform.eulerAngles; if (this.percentage == 0f) { base.transform.Rotate(this.vector3s[1], this.space); } base.transform.eulerAngles = this.vector3s[0]; float num = 1f - this.percentage; this.vector3s[2].x = UnityEngine.Random.Range(-this.vector3s[1].x * num, this.vector3s[1].x * num); this.vector3s[2].y = UnityEngine.Random.Range(-this.vector3s[1].y * num, this.vector3s[1].y * num); this.vector3s[2].z = UnityEngine.Random.Range(-this.vector3s[1].z * num, this.vector3s[1].z * num); base.transform.Rotate(this.vector3s[2], this.space); this.postUpdate = base.transform.eulerAngles; if (this.physics) { base.transform.eulerAngles = this.preUpdate; base.GetComponent().MoveRotation(Quaternion.Euler(this.postUpdate)); } } private void ApplyPunchPositionTargets() { this.preUpdate = base.transform.position; Vector3 eulerAngles = default(Vector3); if (this.tweenArguments.Contains("looktarget")) { eulerAngles = base.transform.eulerAngles; base.transform.eulerAngles = this.vector3s[4]; } if (this.vector3s[1].x > 0f) { this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null); } else if (this.vector3s[1].x < 0f) { this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null); } if (this.vector3s[1].y > 0f) { this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null); } else if (this.vector3s[1].y < 0f) { this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null); } if (this.vector3s[1].z > 0f) { this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null); } else if (this.vector3s[1].z < 0f) { this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null); } base.transform.Translate(this.vector3s[2] - this.vector3s[3], this.space); this.vector3s[3] = this.vector3s[2]; if (this.tweenArguments.Contains("looktarget")) { base.transform.eulerAngles = eulerAngles; } this.postUpdate = base.transform.position; if (this.physics) { base.transform.position = this.preUpdate; base.GetComponent().MovePosition(this.postUpdate); } } private void ApplyPunchRotationTargets() { this.preUpdate = base.transform.eulerAngles; if (this.vector3s[1].x > 0f) { this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null); } else if (this.vector3s[1].x < 0f) { this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null); } if (this.vector3s[1].y > 0f) { this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null); } else if (this.vector3s[1].y < 0f) { this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null); } if (this.vector3s[1].z > 0f) { this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null); } else if (this.vector3s[1].z < 0f) { this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null); } base.transform.Rotate(this.vector3s[2] - this.vector3s[3], this.space); this.vector3s[3] = this.vector3s[2]; this.postUpdate = base.transform.eulerAngles; if (this.physics) { base.transform.eulerAngles = this.preUpdate; base.GetComponent().MoveRotation(Quaternion.Euler(this.postUpdate)); } } private void ApplyPunchScaleTargets() { if (this.vector3s[1].x > 0f) { this.vector3s[2].x = AMTween.punch(this.vector3s[1].x, this.percentage, null); } else if (this.vector3s[1].x < 0f) { this.vector3s[2].x = -AMTween.punch(Mathf.Abs(this.vector3s[1].x), this.percentage, null); } if (this.vector3s[1].y > 0f) { this.vector3s[2].y = AMTween.punch(this.vector3s[1].y, this.percentage, null); } else if (this.vector3s[1].y < 0f) { this.vector3s[2].y = -AMTween.punch(Mathf.Abs(this.vector3s[1].y), this.percentage, null); } if (this.vector3s[1].z > 0f) { this.vector3s[2].z = AMTween.punch(this.vector3s[1].z, this.percentage, null); } else if (this.vector3s[1].z < 0f) { this.vector3s[2].z = -AMTween.punch(Mathf.Abs(this.vector3s[1].z), this.percentage, null); } base.transform.localScale = this.vector3s[0] + this.vector3s[2]; } private void ApplyCameraFadeValueTargets() { AMTween.cf.value = this.ease(1f, 0f, this.percentage, this.easeCurve); AMTween.cf.percent = this.percentage; } private IEnumerator TweenDelay() { this.delayStarted = NTime.time; while (NTime.time - this.delayStarted < this.delay) { yield return null; } if (this.wasPaused) { this.wasPaused = false; this.TweenStart(true); } yield break; } private void TweenStart(bool checkConflict = true) { this.CallBack("onstart"); this.sendMessage(); this.invokeMethod(); this.playAnimation(); this.playAudio(); if (!this.loop) { if (checkConflict) { this.ConflictCheck(); } this.GenerateTargets(); } if (this.type == "stab") { this.audioSource.PlayOneShot(this.audioSource.clip); } if (this.type == "move" || this.type == "scale" || this.type == "rotate" || this.type == "punch" || this.type == "shake" || this.type == "curve" || this.type == "look") { this.EnableKinematic(); } this.isRunning = true; } private IEnumerator TweenRestart() { if (this.delay > 0f) { this.delayStarted = NTime.time; while (NTime.time - this.delayStarted < this.delay) { yield return null; } } this.loop = true; this.TweenStart(true); yield break; } private void TweenUpdate() { if (!this.isRunning) { return; } if (this.apply != null) { this.apply(); } this.CallBack("onupdate"); this.UpdatePercentage(); if ((string)this.tweenArguments["method"] == "animation") { GameObject gameObject = this.tweenArguments["target"] as GameObject; AnimationClip clip = gameObject.GetComponent().GetClip((string)this.tweenArguments["animation"]); clip.SampleAnimation(gameObject, NTime.time - (this.delayStarted + this.delay)); } } private void TweenComplete(bool end = false) { if (!this.isRunning) { return; } if (end && this.apply == null) { this.GenerateTargets(); } this.isRunning = false; if (end || this.percentage > 0.5f) { this.percentage = 1f; } else { this.percentage = 0f; } if (this.apply != null) { this.apply(); } if (this.type == "value") { this.CallBack("onupdate"); } if (this.loopType == AMTween.LoopType.none) { this.Dispose(); } else if ((string)this.tweenArguments["method"] != "audio") { this.TweenLoop(); } this.CallBack("oncomplete"); } private void TweenLoop() { if (!this.isRunning) { return; } this.DisableKinematic(); AMTween.LoopType loopType = this.loopType; if (loopType != AMTween.LoopType.loop) { if (loopType == AMTween.LoopType.pingPong) { this.reverse = !this.reverse; this.runningTime = 0f; base.StartCoroutine("TweenRestart"); } } else { this.percentage = 0f; this.runningTime = 0f; if (this.apply != null) { this.apply(); } base.StartCoroutine("TweenRestart"); } } private void resumeExtras() { if (this.delay > 0f) { return; } if ((string)this.tweenArguments["method"] == "audio") { (this.tweenArguments["audiosource"] as AudioSource).time = this.runningTime % (this.tweenArguments["audioclip"] as AudioClip).length; (this.tweenArguments["audiosource"] as AudioSource).Play(); } else if ((string)this.tweenArguments["method"] == "animation") { (this.tweenArguments["target"] as GameObject).GetComponent()[(string)this.tweenArguments["animation"]].time = this.runningTime; } } private void pauseExtras() { if (this.delay > 0f) { return; } if ((string)this.tweenArguments["method"] == "audio") { (this.tweenArguments["audiosource"] as AudioSource).Stop(); } else if ((string)this.tweenArguments["method"] == "animation") { (this.tweenArguments["target"] as GameObject).GetComponent().Stop(); } } private void playAnimation() { if ((string)this.tweenArguments["method"] != "animation") { return; } if (this.tweenArguments["wrapmode"] != null) { (this.tweenArguments["target"] as GameObject).GetComponent().wrapMode = (WrapMode)this.tweenArguments["wrapmode"]; } if (this.tweenArguments["crossfade"] == null || (bool)this.tweenArguments["crossfade"]) { } } private void playAudio() { if ((string)this.tweenArguments["method"] != "audio") { return; } if ((this.tweenArguments["audiosource"] as AudioSource).isPlaying) { (this.tweenArguments["audiosource"] as AudioSource).Stop(); } if (this.tweenArguments["loop"] != null) { (this.tweenArguments["audiosource"] as AudioSource).loop = (bool)this.tweenArguments["loop"]; } (this.tweenArguments["audiosource"] as AudioSource).time = this.runningTime; (this.tweenArguments["audiosource"] as AudioSource).clip = null; (this.tweenArguments["audiosource"] as AudioSource).clip = (this.tweenArguments["audioclip"] as AudioClip); (this.tweenArguments["audiosource"] as AudioSource).pitch = 1f; (this.tweenArguments["audiosource"] as AudioSource).Play(); } private void sendMessage() { if ((string)this.tweenArguments["method"] != "message") { return; } if (this.tweenArguments["parameter"] != null) { object value = this.tweenArguments["parameter"]; (this.tweenArguments["target"] as GameObject).SendMessage(this.tweenArguments["methodname"] as string, value); } else { (this.tweenArguments["target"] as GameObject).SendMessage(this.tweenArguments["methodname"] as string); } } private void invokeMethod() { if ((string)this.tweenArguments["type"] != "invoke") { return; } try { if (this.tweenArguments["parameters"] != null) { object[] array = this.tweenArguments["parameters"] as object[]; ParameterInfo[] parameters = (this.tweenArguments["methodinfo"] as MethodInfo).GetParameters(); for (int i = 0; i < parameters.Length; i++) { if (array[i].GetType() != parameters[i].ParameterType) { Debug.LogWarning("AMTween: Error casting parameters for method '" + (this.tweenArguments["methodinfo"] as MethodInfo).Name + "'. If your parameters include derivatives of UnityEngine.Object[] (such as GameObject[]) try using UnityEngine.Object[] instead."); return; } } (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, this.tweenArguments["parameters"] as object[]); } else { (this.tweenArguments["methodinfo"] as MethodInfo).Invoke(this.tweenArguments["component"] as Component, null); } } catch { Debug.LogWarning(string.Concat(new object[] { "AMTween: Error processing method '", (this.tweenArguments["methodinfo"] as MethodInfo).Name, "' parameters. Are you passing a null value? ", this.tweenArguments["trackid"], " at ", this.delayStarted, "s" })); } } public static Rect RectUpdate(Rect currentValue, Rect targetValue, float speed) { Rect result = new Rect(AMTween.FloatUpdate(currentValue.x, targetValue.x, speed), AMTween.FloatUpdate(currentValue.y, targetValue.y, speed), AMTween.FloatUpdate(currentValue.width, targetValue.width, speed), AMTween.FloatUpdate(currentValue.height, targetValue.height, speed)); return result; } public static Vector3 Vector3Update(Vector3 currentValue, Vector3 targetValue, float speed) { Vector3 a = targetValue - currentValue; currentValue += a * speed * NTime.deltaTime; return currentValue; } public static Vector2 Vector2Update(Vector2 currentValue, Vector2 targetValue, float speed) { Vector2 a = targetValue - currentValue; currentValue += a * speed * NTime.deltaTime; return currentValue; } public static float FloatUpdate(float currentValue, float targetValue, float speed) { float num = targetValue - currentValue; currentValue += num * speed * NTime.deltaTime; return currentValue; } public static void FadeUpdate(GameObject target, Hashtable args) { args["a"] = args["alpha"]; AMTween.ColorUpdate(target, args); } public static void FadeUpdate(GameObject target, float alpha, float time, string trackId) { AMTween.FadeUpdate(target, AMTween.Hash(new object[] { "trackid", trackId, "alpha", alpha, "time", time })); } public static void ColorUpdate(GameObject target, Hashtable args) { AMTween.CleanArgs(args); Color[] array = new Color[4]; if (!args.Contains("includechildren") || (bool)args["includechildren"]) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.ColorUpdate(transform.gameObject, args); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } float num; if (args.Contains("time")) { num = (float)args["time"]; num *= AMTween.Defaults.updateTimePercentage; } else { num = AMTween.Defaults.updateTime; } if (target.GetComponent(typeof(GUITexture))) { array[0] = (array[1] = target.GetComponent().color); } else if (target.GetComponent(typeof(GUIText))) { array[0] = (array[1] = target.GetComponent().material.color); } else if (target.GetComponent()) { array[0] = (array[1] = target.GetComponent().material.color); } else if (target.GetComponent()) { array[0] = (array[1] = target.GetComponent().color); } if (args.Contains("color")) { array[1] = (Color)args["color"]; } else { if (args.Contains("r")) { array[1].r = (float)args["r"]; } if (args.Contains("g")) { array[1].g = (float)args["g"]; } if (args.Contains("b")) { array[1].b = (float)args["b"]; } if (args.Contains("a")) { array[1].a = (float)args["a"]; } } array[3].r = Mathf.SmoothDamp(array[0].r, array[1].r, ref array[2].r, num); array[3].g = Mathf.SmoothDamp(array[0].g, array[1].g, ref array[2].g, num); array[3].b = Mathf.SmoothDamp(array[0].b, array[1].b, ref array[2].b, num); array[3].a = Mathf.SmoothDamp(array[0].a, array[1].a, ref array[2].a, num); if (target.GetComponent(typeof(GUITexture))) { target.GetComponent().color = array[3]; } else if (target.GetComponent(typeof(GUIText))) { target.GetComponent().material.color = array[3]; } else if (target.GetComponent()) { target.GetComponent().material.color = array[3]; } else if (target.GetComponent()) { target.GetComponent().color = array[3]; } } public static void ColorUpdate(GameObject target, Color color, float time, string trackId) { AMTween.ColorUpdate(target, AMTween.Hash(new object[] { "trackid", trackId, "color", color, "time", time })); } public static void AudioUpdate(GameObject target, Hashtable args) { AMTween.CleanArgs(args); Vector2[] array = new Vector2[4]; float num; if (args.Contains("time")) { num = (float)args["time"]; num *= AMTween.Defaults.updateTimePercentage; } else { num = AMTween.Defaults.updateTime; } AudioSource audioSource; if (args.Contains("audiosource")) { audioSource = (AudioSource)args["audiosource"]; } else { if (!target.GetComponent(typeof(AudioSource))) { Debug.LogError("AMTween Error: AudioUpdate requires an AudioSource."); return; } audioSource = target.GetComponent(); } array[0] = (array[1] = new Vector2(audioSource.volume, audioSource.pitch)); if (args.Contains("volume")) { array[1].x = (float)args["volume"]; } if (args.Contains("pitch")) { array[1].y = (float)args["pitch"]; } array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num); array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num); audioSource.volume = array[3].x; audioSource.pitch = array[3].y; } public static void AudioUpdate(GameObject target, float volume, float pitch, float time, string trackId) { AMTween.AudioUpdate(target, AMTween.Hash(new object[] { "trackid", trackId, "volume", volume, "pitch", pitch, "time", time })); } public static void RotateUpdate(GameObject target, Hashtable args) { AMTween.CleanArgs(args); Vector3[] array = new Vector3[4]; Vector3 eulerAngles = target.transform.eulerAngles; float num; if (args.Contains("time")) { num = (float)args["time"]; num *= AMTween.Defaults.updateTimePercentage; } else { num = AMTween.Defaults.updateTime; } bool flag; if (args.Contains("islocal")) { flag = (bool)args["islocal"]; } else { flag = AMTween.Defaults.isLocal; } if (flag) { array[0] = target.transform.localEulerAngles; } else { array[0] = target.transform.eulerAngles; } if (args.Contains("rotation")) { if (args["rotation"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["rotation"]; array[1] = transform.eulerAngles; } else if (args["rotation"].GetType() == typeof(Vector3)) { array[1] = (Vector3)args["rotation"]; } } array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num); array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num); array[3].z = Mathf.SmoothDampAngle(array[0].z, array[1].z, ref array[2].z, num); if (flag) { target.transform.localEulerAngles = array[3]; } else { target.transform.eulerAngles = array[3]; } if (target.GetComponent() != null) { Vector3 eulerAngles2 = target.transform.eulerAngles; target.transform.eulerAngles = eulerAngles; target.GetComponent().MoveRotation(Quaternion.Euler(eulerAngles2)); } } public static void RotateUpdate(GameObject target, Vector3 rotation, float time, string trackId) { AMTween.RotateUpdate(target, AMTween.Hash(new object[] { "trackid", trackId, "rotation", rotation, "time", time })); } public static void ScaleUpdate(GameObject target, Hashtable args) { AMTween.CleanArgs(args); Vector3[] array = new Vector3[4]; float num; if (args.Contains("time")) { num = (float)args["time"]; num *= AMTween.Defaults.updateTimePercentage; } else { num = AMTween.Defaults.updateTime; } array[0] = (array[1] = target.transform.localScale); if (args.Contains("scale")) { if (args["scale"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["scale"]; array[1] = transform.localScale; } else if (args["scale"].GetType() == typeof(Vector3)) { array[1] = (Vector3)args["scale"]; } } else { if (args.Contains("x")) { array[1].x = (float)args["x"]; } if (args.Contains("y")) { array[1].y = (float)args["y"]; } if (args.Contains("z")) { array[1].z = (float)args["z"]; } } array[3].x = Mathf.SmoothDamp(array[0].x, array[1].x, ref array[2].x, num); array[3].y = Mathf.SmoothDamp(array[0].y, array[1].y, ref array[2].y, num); array[3].z = Mathf.SmoothDamp(array[0].z, array[1].z, ref array[2].z, num); target.transform.localScale = array[3]; } public static void ScaleUpdate(GameObject target, Vector3 scale, float time, string trackId) { AMTween.ScaleUpdate(target, AMTween.Hash(new object[] { "trackid", trackId, "scale", scale, "time", time })); } public static void MoveUpdate(GameObject target, Hashtable args) { AMTween.CleanArgs(args); Vector3[] array = new Vector3[4]; Vector3 position = target.transform.position; float num; if (args.Contains("time")) { num = (float)args["time"]; num *= AMTween.Defaults.updateTimePercentage; } else { num = AMTween.Defaults.updateTime; } bool flag; if (args.Contains("islocal")) { flag = (bool)args["islocal"]; } else { flag = AMTween.Defaults.isLocal; } if (flag) { array[0] = (array[1] = target.transform.localPosition); } else { array[0] = (array[1] = target.transform.position); } if (args.Contains("position")) { if (args["position"].GetType() == typeof(Transform)) { Transform transform = (Transform)args["position"]; array[1] = transform.position; } else if (args["position"].GetType() == typeof(Vector3)) { array[1] = (Vector3)args["position"]; } } else { if (args.Contains("x")) { array[1].x = (float)args["x"]; } if (args.Contains("y")) { array[1].y = (float)args["y"]; } if (args.Contains("z")) { array[1].z = (float)args["z"]; } } array[3].x = Mathf.SmoothDamp(array[0].x, array[1].x, ref array[2].x, num); array[3].y = Mathf.SmoothDamp(array[0].y, array[1].y, ref array[2].y, num); array[3].z = Mathf.SmoothDamp(array[0].z, array[1].z, ref array[2].z, num); if (args.Contains("orienttopath") && (bool)args["orienttopath"]) { args["looktarget"] = array[3]; } if (args.Contains("looktarget")) { AMTween.LookUpdate(target, args); } if (flag) { target.transform.localPosition = array[3]; } else { target.transform.position = array[3]; } if (target.GetComponent() != null) { Vector3 position2 = target.transform.position; target.transform.position = position; target.GetComponent().MovePosition(position2); } } public static void MoveUpdate(GameObject target, Vector3 position, float time, string trackId) { AMTween.MoveUpdate(target, AMTween.Hash(new object[] { "trackid", trackId, "position", position, "time", time })); } public static void LookUpdate(GameObject target, Hashtable args) { AMTween.CleanArgs(args); Vector3[] array = new Vector3[5]; float num; if (args.Contains("looktime")) { num = (float)args["looktime"]; num *= AMTween.Defaults.updateTimePercentage; } else if (args.Contains("time")) { num = (float)args["time"] * 0.15f; num *= AMTween.Defaults.updateTimePercentage; } else { num = AMTween.Defaults.updateTime; } array[0] = target.transform.eulerAngles; if (args.Contains("looktarget")) { if (args["looktarget"].GetType() == typeof(Transform)) { Transform transform = target.transform; Transform target2 = (Transform)args["looktarget"]; Vector3? vector = (Vector3?)args["up"]; transform.LookAt(target2, (vector == null) ? AMTween.Defaults.up : vector.Value); } else if (args["looktarget"].GetType() == typeof(Vector3)) { Transform transform2 = target.transform; Vector3 worldPosition = (Vector3)args["looktarget"]; Vector3? vector2 = (Vector3?)args["up"]; transform2.LookAt(worldPosition, (vector2 == null) ? AMTween.Defaults.up : vector2.Value); } array[1] = target.transform.eulerAngles; target.transform.eulerAngles = array[0]; array[3].x = Mathf.SmoothDampAngle(array[0].x, array[1].x, ref array[2].x, num); array[3].y = Mathf.SmoothDampAngle(array[0].y, array[1].y, ref array[2].y, num); array[3].z = Mathf.SmoothDampAngle(array[0].z, array[1].z, ref array[2].z, num); target.transform.eulerAngles = array[3]; if (args.Contains("axis")) { array[4] = target.transform.eulerAngles; string text = (string)args["axis"]; if (text != null) { if (!(text == "x")) { if (!(text == "y")) { if (text == "z") { array[4].x = array[0].x; array[4].y = array[0].y; } } else { array[4].x = array[0].x; array[4].z = array[0].z; } } else { array[4].y = array[0].y; array[4].z = array[0].z; } } target.transform.eulerAngles = array[4]; } return; } Debug.LogError("AMTween Error: LookUpdate needs a 'looktarget' property!"); } public static void LookUpdate(GameObject target, Vector3 looktarget, float time, string trackId) { AMTween.LookUpdate(target, AMTween.Hash(new object[] { "trackid", trackId, "looktarget", looktarget, "time", time })); } public static void SetMorph(Component component, MethodInfo setPercent, float[] morph) { for (int i = 0; i < morph.Length; i++) { setPercent.Invoke(component, new object[] { i, morph[i] }); } } public static Texture2D LoadTexture2D(string name) { return (Texture2D)Resources.Load(name); } public Vector3 getPositionAfter(float time) { return this.getPositionAtPercentage(this.getIncPercentageBy(time)); } public Vector3 getPositionAtPercentage(float percentage) { float value = this.ease(0f, 1f, percentage, this.easeCurve); return this.path.Interp(Mathf.Clamp(value, 0f, 1f)); } public static void ShowColor(Color color) { AMTween.cf.keepAliveColor = true; AMTween.cf.colorTex = color; AMTween.cf.hasColorTex = true; AMTween.cf.hasColorBG = false; AMTween.cf.mode = 0; AMTween.cf.value = 1f; AMTween.cf.isReset = false; } public static void SetTopCamera(Camera top, Camera bottom) { if (top) { top.depth = 0f; } if (bottom) { bottom.depth = -1f; } } public static void SetTopCamera(Camera top, Camera[] all) { top.depth = 0f; foreach (Camera camera in all) { if (camera != top) { camera.depth = -1f; } } } private void CameraFadeCleanup() { if ((string)this.tweenArguments["type"] != "camerafade") { return; } Color? color = null; if ((bool)this.tweenArguments["reversed"] && this.tweenArguments.Contains("camera2")) { AMTween.SetTopCamera((Camera)this.tweenArguments["camera2"], (Camera[])this.tweenArguments["allcameras"]); } if (this.tweenArguments.Contains("color2")) { color = new Color?((Color)this.tweenArguments["color2"]); } if (color != null) { AMTween.cf.keepAliveColor = true; AMTween.cf.hasColorTex = true; AMTween.cf.hasColorBG = false; AMTween.cf.colorTex = color.Value; AMTween.cf.mode = 0; AMTween.cf.value = 1f; } else { AMCameraFade.reset(); } if ((bool)this.tweenArguments["userendertex"]) { if (this.tweenArguments.Contains("camera1")) { (this.tweenArguments["camera1"] as Camera).targetTexture = null; } if (this.tweenArguments.Contains("camera2")) { (this.tweenArguments["camera2"] as Camera).targetTexture = null; } } if (AMCameraFade.hasInstance()) { AMTween.cf.clearTexture2D(); AMTween.cf.keepAlives--; } } public static Texture2D GetScreenTexture() { Texture2D texture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); texture2D.ReadPixels(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), 0, 0, false); texture2D.Apply(); return texture2D; } public static AnimationCurve GenerateCurve(float[] keyFrameInfo) { AnimationCurve animationCurve = new AnimationCurve(); if (keyFrameInfo.Length % 4 != 0) { Debug.LogError("AMTween: GenerateCurve requires keyframe information as a multiple of 4. (time, value, inTangent, outTangent)"); return animationCurve; } for (int i = 0; i < keyFrameInfo.Length; i += 4) { animationCurve.AddKey(new Keyframe(keyFrameInfo[i], keyFrameInfo[i + 1], keyFrameInfo[i + 2], keyFrameInfo[i + 3])); } return animationCurve; } public static float PathLength(Transform[] path) { Vector3[] array = new Vector3[path.Length]; float num = 0f; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } Vector3[] pts = AMTween.PathControlPointGenerator(array); Vector3 a = AMTween.Interp(pts, 0f); int num2 = path.Length * 20; for (int j = 1; j <= num2; j++) { float t = (float)j / (float)num2; Vector3 vector = AMTween.Interp(pts, t); num += Vector3.Distance(a, vector); a = vector; } return num; } public static float PathLength(Vector3[] path) { float num = 0f; Vector3[] pts = AMTween.PathControlPointGenerator(path); Vector3 a = AMTween.Interp(pts, 0f); int num2 = path.Length * 20; for (int i = 1; i <= num2; i++) { float t = (float)i / (float)num2; Vector3 vector = AMTween.Interp(pts, t); num += Vector3.Distance(a, vector); a = vector; } return num; } public static Texture2D CameraTexture(Color color) { Texture2D texture2D = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false); Color[] array = new Color[Screen.width * Screen.height]; for (int i = 0; i < array.Length; i++) { array[i] = color; } texture2D.SetPixels(array); texture2D.Apply(); return texture2D; } public static void PutOnPath(GameObject target, Vector3[] path, float percent) { target.transform.position = AMTween.Interp(AMTween.PathControlPointGenerator(path), percent); } public static void PutOnPath(Transform target, Vector3[] path, float percent) { target.position = AMTween.Interp(AMTween.PathControlPointGenerator(path), percent); } public static Vector3 PositionOnPath(Vector3[] path, float percent) { return AMTween.Interp(AMTween.PathControlPointGenerator(path), percent); } public static void PutOnPath(GameObject target, Transform[] path, float percent) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } target.transform.position = AMTween.Interp(AMTween.PathControlPointGenerator(array), percent); } public static void PutOnPath(Transform target, Transform[] path, float percent) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } target.position = AMTween.Interp(AMTween.PathControlPointGenerator(array), percent); } public static Vector3 PointOnPath(Transform[] path, float percent) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } return AMTween.Interp(AMTween.PathControlPointGenerator(array), percent); } public static void DrawLine(Vector3[] line) { if (line.Length > 0) { AMTween.DrawLineHelper(line, AMTween.Defaults.color, "gizmos"); } } public static void DrawLine(Vector3[] line, Color color) { if (line.Length > 0) { AMTween.DrawLineHelper(line, color, "gizmos"); } } public static void DrawLine(Transform[] line) { if (line.Length > 0) { Vector3[] array = new Vector3[line.Length]; for (int i = 0; i < line.Length; i++) { array[i] = line[i].position; } AMTween.DrawLineHelper(array, AMTween.Defaults.color, "gizmos"); } } public static void DrawLine(Transform[] line, Color color) { if (line.Length > 0) { Vector3[] array = new Vector3[line.Length]; for (int i = 0; i < line.Length; i++) { array[i] = line[i].position; } AMTween.DrawLineHelper(array, color, "gizmos"); } } public static void DrawLineGizmos(Vector3[] line) { if (line.Length > 0) { AMTween.DrawLineHelper(line, AMTween.Defaults.color, "gizmos"); } } public static void DrawLineGizmos(Vector3[] line, Color color) { if (line.Length > 0) { AMTween.DrawLineHelper(line, color, "gizmos"); } } public static void DrawLineGizmos(Transform[] line) { if (line.Length > 0) { Vector3[] array = new Vector3[line.Length]; for (int i = 0; i < line.Length; i++) { array[i] = line[i].position; } AMTween.DrawLineHelper(array, AMTween.Defaults.color, "gizmos"); } } public static void DrawLineGizmos(Transform[] line, Color color) { if (line.Length > 0) { Vector3[] array = new Vector3[line.Length]; for (int i = 0; i < line.Length; i++) { array[i] = line[i].position; } AMTween.DrawLineHelper(array, color, "gizmos"); } } public static void DrawLineHandles(Vector3[] line) { if (line.Length > 0) { AMTween.DrawLineHelper(line, AMTween.Defaults.color, "handles"); } } public static void DrawLineHandles(Vector3[] line, Color color) { if (line.Length > 0) { AMTween.DrawLineHelper(line, color, "handles"); } } public static void DrawLineHandles(Transform[] line) { if (line.Length > 0) { Vector3[] array = new Vector3[line.Length]; for (int i = 0; i < line.Length; i++) { array[i] = line[i].position; } AMTween.DrawLineHelper(array, AMTween.Defaults.color, "handles"); } } public static void DrawLineHandles(Transform[] line, Color color) { if (line.Length > 0) { Vector3[] array = new Vector3[line.Length]; for (int i = 0; i < line.Length; i++) { array[i] = line[i].position; } AMTween.DrawLineHelper(array, color, "handles"); } } public static Vector3 PointOnPath(Vector3[] path, float percent) { return AMTween.Interp(AMTween.PathControlPointGenerator(path), percent); } public static void DrawPath(Vector3[] path) { if (path.Length > 0) { AMTween.DrawPathHelper(path, AMTween.Defaults.color, "gizmos"); } } public static void DrawPath(Vector3[] path, Color color) { if (path.Length > 0) { AMTween.DrawPathHelper(path, color, "gizmos"); } } public static void DrawPath(Transform[] path) { if (path.Length > 0) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } AMTween.DrawPathHelper(array, AMTween.Defaults.color, "gizmos"); } } public static void DrawPath(Transform[] path, Color color) { if (path.Length > 0) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } AMTween.DrawPathHelper(array, color, "gizmos"); } } public static void DrawPathGizmos(Vector3[] path) { if (path.Length > 0) { AMTween.DrawPathHelper(path, AMTween.Defaults.color, "gizmos"); } } public static void DrawPathGizmos(Vector3[] path, Color color) { if (path.Length > 0) { AMTween.DrawPathHelper(path, color, "gizmos"); } } public static void DrawPathGizmos(Transform[] path) { if (path.Length > 0) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } AMTween.DrawPathHelper(array, AMTween.Defaults.color, "gizmos"); } } public static void DrawPathGizmos(Transform[] path, Color color) { if (path.Length > 0) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } AMTween.DrawPathHelper(array, color, "gizmos"); } } public static void DrawPathHandles(Vector3[] path) { if (path.Length > 0) { AMTween.DrawPathHelper(path, AMTween.Defaults.color, "handles"); } } public static void DrawPathHandles(Vector3[] path, Color color) { if (path.Length > 0) { AMTween.DrawPathHelper(path, color, "handles"); } } public static void DrawPathHandles(Transform[] path) { if (path.Length > 0) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } AMTween.DrawPathHelper(array, AMTween.Defaults.color, "handles"); } } public static void DrawPathHandles(Transform[] path, Color color) { if (path.Length > 0) { Vector3[] array = new Vector3[path.Length]; for (int i = 0; i < path.Length; i++) { array[i] = path[i].position; } AMTween.DrawPathHelper(array, color, "handles"); } } public static void CameraFadeDepth(int depth) { if (AMTween.cameraFade) { AMTween.cameraFade.transform.position = new Vector3(AMTween.cameraFade.transform.position.x, AMTween.cameraFade.transform.position.y, (float)depth); } } public static void CameraFadeDestroy() { if (AMTween.cameraFade) { UnityEngine.Object.Destroy(AMTween.cameraFade); } } public static void CameraFadeSwap(Texture2D texture) { if (AMTween.cameraFade) { AMTween.cameraFade.GetComponent().texture = texture; } } public static GameObject CameraFadeAdd(Texture2D texture, int depth) { if (AMTween.cameraFade) { return null; } AMTween.cameraFade = new GameObject("AMTween Camera Fade"); AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)depth); AMTween.cameraFade.AddComponent(); AMTween.cameraFade.GetComponent().texture = texture; AMTween.cameraFade.GetComponent().color = new Color(0.5f, 0.5f, 0.5f, 0f); return AMTween.cameraFade; } public static GameObject CameraFadeAdd(Texture2D texture) { if (AMTween.cameraFade) { return null; } AMTween.cameraFade = new GameObject("AMTween Camera Fade"); AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)AMTween.Defaults.cameraFadeDepth); AMTween.cameraFade.AddComponent(); AMTween.cameraFade.GetComponent().texture = texture; AMTween.cameraFade.GetComponent().color = new Color(0.5f, 0.5f, 0.5f, 0f); return AMTween.cameraFade; } public static GameObject CameraFadeAdd() { if (AMTween.cameraFade) { return null; } AMTween.cameraFade = new GameObject("AMTween Camera Fade"); AMTween.cameraFade.transform.position = new Vector3(0.5f, 0.5f, (float)AMTween.Defaults.cameraFadeDepth); AMTween.cameraFade.AddComponent(); AMTween.cameraFade.GetComponent().texture = AMTween.CameraTexture(Color.black); AMTween.cameraFade.GetComponent().color = new Color(0.5f, 0.5f, 0.5f, 0f); return AMTween.cameraFade; } public static void Resume(GameObject target) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { amtween.enabled = true; amtween.resumeExtras(); } } public static void Resume(GameObject target, bool includechildren) { AMTween.Resume(target); if (includechildren) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.Resume(transform.gameObject, true); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } public static void Resume(GameObject target, string type) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string text = amtween.type + amtween.method; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { amtween.enabled = true; } } } public static void Resume(GameObject target, string type, bool includechildren) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string text = amtween.type + amtween.method; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { amtween.enabled = true; } } if (includechildren) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.Resume(transform.gameObject, type, true); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } public static void Resume() { for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; GameObject target = (GameObject)hashtable["target"]; AMTween.Resume(target); } } public static void Resume(string type) { ArrayList arrayList = new ArrayList(); for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; GameObject value = (GameObject)hashtable["target"]; arrayList.Insert(arrayList.Count, value); } for (int j = 0; j < arrayList.Count; j++) { AMTween.Resume((GameObject)arrayList[j], type); } } public static void Pause(GameObject target) { Component[] components = target.GetComponents(typeof(AMTween)); int num = 0; foreach (AMTween amtween in components) { num++; if (amtween.delay > 0f) { amtween.delay -= NTime.time - amtween.delayStarted; amtween.StopCoroutine("TweenDelay"); } amtween.pauseExtras(); amtween.isPaused = true; amtween.enabled = false; } } public static void Pause(GameObject target, bool includechildren) { AMTween.Pause(target); if (includechildren) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.Pause(transform.gameObject, true); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } public static void Pause(GameObject target, string type) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string text = amtween.type + amtween.method; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { if (amtween.delay > 0f) { amtween.delay -= NTime.time - amtween.delayStarted; amtween.StopCoroutine("TweenDelay"); } amtween.isPaused = true; amtween.enabled = false; } } } public static void Pause(GameObject target, string type, bool includechildren) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string text = amtween.type + amtween.method; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { if (amtween.delay > 0f) { amtween.delay -= NTime.time - amtween.delayStarted; amtween.StopCoroutine("TweenDelay"); } amtween.isPaused = true; amtween.enabled = false; } } if (includechildren) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.Pause(transform.gameObject, type, true); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } public static void Pause(string id, GameObject target) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string a = amtween.id; if (a == id) { if (amtween.delay > 0f) { amtween.delay -= NTime.time - amtween.delayStarted; amtween.StopCoroutine("TweenDelay"); } amtween.pauseExtras(); amtween.isPaused = true; amtween.enabled = false; } } } public static void Pause() { for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; GameObject target = (GameObject)hashtable["target"]; string text = (string)hashtable["id"]; AMTween.Pause(text, target); } } public static void Pause(string type) { ArrayList arrayList = new ArrayList(); for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; GameObject value = (GameObject)hashtable["target"]; arrayList.Insert(arrayList.Count, value); } for (int j = 0; j < arrayList.Count; j++) { AMTween.Pause((GameObject)arrayList[j], type); } } public static int Count() { return AMTween.tweens_.Count; } public static int Count(string type) { int num = 0; for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; string text = (string)hashtable["type"] + (string)hashtable["method"]; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { num++; } } return num; } public static int Count(GameObject target) { Component[] components = target.GetComponents(typeof(AMTween)); return components.Length; } public static int Count(GameObject target, string type) { int num = 0; Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string text = amtween.type + amtween.method; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { num++; } } return num; } public static void StartDisabled() { IEnumerator enumerator = AMTween.disabledTweens.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; AMTween amtween = (AMTween)obj; amtween.enabled = true; } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } AMTween.disabledTweens = new ArrayList(); } public static void Stop() { ArrayList arrayList = new ArrayList(AMTween.tweens_); for (int i = 0; i < arrayList.Count; i++) { Hashtable hashtable = (Hashtable)arrayList[i]; GameObject target = (GameObject)hashtable["target"]; AMTween.Stop(target); } AMTween.tweens_.Clear(); } public static void Stop(string type) { ArrayList arrayList = new ArrayList(); for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; GameObject value = (GameObject)hashtable["target"]; arrayList.Insert(arrayList.Count, value); } for (int j = 0; j < arrayList.Count; j++) { AMTween.Stop((GameObject)arrayList[j], type); } } public static void StopByName(string name) { ArrayList arrayList = new ArrayList(); for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; GameObject value = (GameObject)hashtable["target"]; arrayList.Insert(arrayList.Count, value); } for (int j = 0; j < arrayList.Count; j++) { AMTween.StopByName((GameObject)arrayList[j], name); } } public static void Stop(GameObject target) { if (!target) { return; } Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { amtween.Dispose(); } } public static void Stop(GameObject target, bool includechildren) { AMTween.Stop(target); if (includechildren) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.Stop(transform.gameObject, true); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } public static void Stop(GameObject target, string type) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string text = amtween.type + amtween.method; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { amtween.Dispose(); } } } public static void StopByName(GameObject target, string name) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { if (amtween._name == name) { amtween.Dispose(); } } } public static void Stop(GameObject target, string type, bool includechildren) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { string text = amtween.type + amtween.method; text = text.Substring(0, type.Length); if (text.ToLower() == type.ToLower()) { amtween.Dispose(); } } if (includechildren) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.Stop(transform.gameObject, type, true); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } public static void StopByName(GameObject target, string name, bool includechildren) { Component[] components = target.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { if (amtween._name == name) { amtween.Dispose(); } } if (includechildren) { IEnumerator enumerator = target.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; AMTween.StopByName(transform.gameObject, name, true); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } public static Hashtable Hash(params object[] args) { Hashtable hashtable = new Hashtable(args.Length / 2); if (args.Length % 2 != 0) { Debug.LogError("Tween Error: Hash requires an even number of arguments!"); return null; } for (int i = 0; i < args.Length - 1; i += 2) { if (hashtable.ContainsKey(args[i])) { Debug.LogError("duplicate !" + hashtable[i]); } hashtable.Add(args[i], args[i + 1]); } return hashtable; } private void Awake() { this.RetrieveArgs(); this.lastRealTime = NTime.realtimeSinceStartup; } private IEnumerator Start() { if (this.delay > 0f) { yield return base.StartCoroutine("TweenDelay"); } this.TweenStart(true); yield break; } private void Update() { if (this.isRunning && !this.physics) { if (!this.reverse) { if (this.percentage < 1f) { this.TweenUpdate(); } else { this.TweenComplete(false); } } else if (this.percentage > 0f) { this.TweenUpdate(); } else { this.TweenComplete(false); } } } private void FixedUpdate() { if (this.isRunning && this.physics) { if (!this.reverse) { if (this.percentage < 1f) { this.TweenUpdate(); } else { this.TweenComplete(false); } } else if (this.percentage > 0f) { this.TweenUpdate(); } else { this.TweenComplete(false); } } } private void LateUpdate() { if (this.tweenArguments.Contains("looktarget") && this.isRunning && (this.type == "move" || this.type == "shake" || this.type == "punch")) { AMTween.LookUpdate(base.gameObject, this.tweenArguments); } } private void OnEnable() { if (this.isRunning) { this.EnableKinematic(); } if (this.isPaused) { this.isPaused = false; if (this.delay > 0f) { this.wasPaused = true; this.ResumeDelay(); } } } private void OnDisable() { this.DisableKinematic(); } private static void DrawLineHelper(Vector3[] line, Color color, string method) { Gizmos.color = color; for (int i = 0; i < line.Length - 1; i++) { if (method == "gizmos") { Gizmos.DrawLine(line[i], line[i + 1]); } else if (method == "handles") { Debug.LogError("AMTween Error: Drawing a line with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); } } } private static void DrawPathHelper(Vector3[] path, Color color, string method) { Vector3[] pts = AMTween.PathControlPointGenerator(path); Vector3 to = AMTween.Interp(pts, 0f); Gizmos.color = color; int num = path.Length * 20; for (int i = 1; i <= num; i++) { float t = (float)i / (float)num; Vector3 vector = AMTween.Interp(pts, t); if (method == "gizmos") { Gizmos.DrawLine(vector, to); } else if (method == "handles") { Debug.LogError("AMTween Error: Drawing a path with Handles is temporarily disabled because of compatability issues with Unity 2.6!"); } to = vector; } } private static Vector3[] PathControlPointGenerator(Vector3[] path) { int num = 2; Vector3[] array = new Vector3[path.Length + num]; Array.Copy(path, 0, array, 1, path.Length); array[0] = array[1] + (array[1] - array[2]); array[array.Length - 1] = array[array.Length - 2] + (array[array.Length - 2] - array[array.Length - 3]); if (array[1] == array[array.Length - 2]) { Vector3[] array2 = new Vector3[array.Length]; Array.Copy(array, array2, array.Length); array2[0] = array2[array2.Length - 3]; array2[array2.Length - 1] = array2[2]; array = new Vector3[array2.Length]; Array.Copy(array2, array, array2.Length); } return array; } private static Vector3 Interp(Vector3[] pts, float t) { int num = pts.Length - 3; int num2 = Mathf.Min(Mathf.FloorToInt(t * (float)num), num - 1); float num3 = t * (float)num - (float)num2; Vector3 a = pts[num2]; Vector3 a2 = pts[num2 + 1]; Vector3 vector = pts[num2 + 2]; Vector3 b = pts[num2 + 3]; return 0.5f * ((-a + 3f * a2 - 3f * vector + b) * (num3 * num3 * num3) + (2f * a - 5f * a2 + 4f * vector - b) * (num3 * num3) + (-a + vector) * num3 + 2f * a2); } private static void Launch(GameObject target, Hashtable args) { if (!args.Contains("id")) { args["id"] = AMTween.GenerateID(); } if (!args.Contains("target")) { args["target"] = target; } AMTween.tweens_.Insert(0, args); target.AddComponent(); } private static void Launch(Component component, Hashtable args) { if (!args.Contains("id")) { args["id"] = AMTween.GenerateID(); } if (!args.Contains("component")) { args["component"] = component; } args["target"] = component.gameObject; AMTween.tweens_.Insert(0, args); component.gameObject.AddComponent(); } private static Hashtable CleanArgs(Hashtable args) { Hashtable hashtable = new Hashtable(args.Count); Hashtable hashtable2 = new Hashtable(args.Count); IDictionaryEnumerator enumerator = args.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; DictionaryEntry dictionaryEntry = (DictionaryEntry)obj; hashtable.Add(dictionaryEntry.Key, dictionaryEntry.Value); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } IDictionaryEnumerator enumerator2 = hashtable.GetEnumerator(); try { while (enumerator2.MoveNext()) { object obj2 = enumerator2.Current; DictionaryEntry dictionaryEntry2 = (DictionaryEntry)obj2; if (dictionaryEntry2.Value != null) { if (dictionaryEntry2.Value.GetType() == typeof(int)) { int num = (int)dictionaryEntry2.Value; float num2 = (float)num; args[dictionaryEntry2.Key] = num2; } if (dictionaryEntry2.Value.GetType() == typeof(double)) { double num3 = (double)dictionaryEntry2.Value; float num4 = (float)num3; args[dictionaryEntry2.Key] = num4; } } } } finally { IDisposable disposable2; if ((disposable2 = (enumerator2 as IDisposable)) != null) { disposable2.Dispose(); } } IDictionaryEnumerator enumerator3 = args.GetEnumerator(); try { while (enumerator3.MoveNext()) { object obj3 = enumerator3.Current; DictionaryEntry dictionaryEntry3 = (DictionaryEntry)obj3; hashtable2.Add(dictionaryEntry3.Key.ToString().ToLower(), dictionaryEntry3.Value); } } finally { IDisposable disposable3; if ((disposable3 = (enumerator3 as IDisposable)) != null) { disposable3.Dispose(); } } args = hashtable2; return args; } private static string GenerateID() { int num = 15; char[] array = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8' }; int max = array.Length - 1; string text = string.Empty; for (int i = 0; i < num; i++) { text += array[(int)Mathf.Floor((float)UnityEngine.Random.Range(0, max))]; } return text; } private void RetrieveArgs() { IEnumerator enumerator = AMTween.tweens_.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Hashtable hashtable = (Hashtable)obj; if ((GameObject)hashtable["target"] == base.gameObject) { this.tweenArguments = hashtable; break; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } this.id = (string)this.tweenArguments["id"]; this.type = (string)this.tweenArguments["type"]; this._name = (string)this.tweenArguments["name"]; this.method = (string)this.tweenArguments["method"]; if (this.tweenArguments.Contains("time")) { this.time = (float)this.tweenArguments["time"]; } else { this.time = AMTween.Defaults.time; } if (base.GetComponent() != null) { this.physics = true; } if (this.tweenArguments.Contains("delay")) { this.delay = (float)this.tweenArguments["delay"]; if (this.delay < 0f) { this.runningTime = -this.delay; this.delay = 0f; } } else { this.delay = AMTween.Defaults.delay; } if (this.tweenArguments.Contains("namedcolorvalue")) { if (this.tweenArguments["namedcolorvalue"].GetType() == typeof(AMTween.NamedValueColor)) { this.namedcolorvalue = (AMTween.NamedValueColor)this.tweenArguments["namedcolorvalue"]; } else { try { this.namedcolorvalue = (AMTween.NamedValueColor)Enum.Parse(typeof(AMTween.NamedValueColor), (string)this.tweenArguments["namedcolorvalue"], true); } catch { Debug.LogWarning("AMTween: Unsupported namedcolorvalue supplied! Default will be used."); this.namedcolorvalue = AMTween.NamedValueColor._Color; } } } else { this.namedcolorvalue = AMTween.Defaults.namedColorValue; } if (this.tweenArguments.Contains("looptype")) { if (this.tweenArguments["looptype"].GetType() == typeof(AMTween.LoopType)) { this.loopType = (AMTween.LoopType)this.tweenArguments["looptype"]; } else { try { this.loopType = (AMTween.LoopType)Enum.Parse(typeof(AMTween.LoopType), (string)this.tweenArguments["looptype"], true); } catch { Debug.LogWarning("AMTween: Unsupported loopType supplied! Default will be used."); this.loopType = AMTween.LoopType.none; } } } else { this.loopType = AMTween.LoopType.none; } if (this.tweenArguments.Contains("easetype")) { if (this.tweenArguments["easetype"].GetType() == typeof(AMTween.EaseType)) { this.easeType = (AMTween.EaseType)this.tweenArguments["easetype"]; } else { try { this.easeType = (AMTween.EaseType)Enum.Parse(typeof(AMTween.EaseType), (string)this.tweenArguments["easetype"], true); } catch { Debug.LogWarning("AMTween: Unsupported easeType supplied! Default will be used."); this.easeType = AMTween.Defaults.easeType; } } } else { this.easeType = AMTween.Defaults.easeType; } if (this.tweenArguments.Contains("easecurve") && this.tweenArguments["easecurve"] != null) { if (this.tweenArguments["easecurve"].GetType() == typeof(AnimationCurve)) { this.easeCurve = (AnimationCurve)this.tweenArguments["easecurve"]; } else { Debug.LogWarning("AMTween: Unsupported easeCurve supplied! Default will be used."); this.easeCurve = null; } } else { this.easeCurve = null; } if (this.tweenArguments.Contains("space")) { if (this.tweenArguments["space"].GetType() == typeof(Space)) { this.space = (Space)this.tweenArguments["space"]; } else { try { this.space = (Space)Enum.Parse(typeof(Space), (string)this.tweenArguments["space"], true); } catch { Debug.LogWarning("AMTween: Unsupported space supplied! Default will be used."); this.space = AMTween.Defaults.space; } } } else { this.space = AMTween.Defaults.space; } if (this.tweenArguments.Contains("islocal")) { this.isLocal = (bool)this.tweenArguments["islocal"]; } else { this.isLocal = AMTween.Defaults.isLocal; } if (this.tweenArguments.Contains("ignoretimescale")) { this.useRealTime = (bool)this.tweenArguments["ignoretimescale"]; } else { this.useRealTime = AMTween.Defaults.useRealTime; } this.GetEasingFunction(); if (this.tweenArguments.Contains("runningtime")) { this.runningTime = (float)this.tweenArguments["runningtime"]; } if (this.tweenArguments.Contains("disable") && (bool)this.tweenArguments["disable"]) { AMTween.disabledTweens.Add(this); base.enabled = false; } } private void GetEasingFunction() { if (this.easeCurve != null) { this.ease = new AMTween.EasingFunction(AMTween.customEase); return; } switch (this.easeType) { case AMTween.EaseType.easeInQuad: this.ease = new AMTween.EasingFunction(AMTween.easeInQuad); break; case AMTween.EaseType.easeOutQuad: this.ease = new AMTween.EasingFunction(AMTween.easeOutQuad); break; case AMTween.EaseType.easeInOutQuad: this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuad); break; case AMTween.EaseType.easeInCubic: this.ease = new AMTween.EasingFunction(AMTween.easeInCubic); break; case AMTween.EaseType.easeOutCubic: this.ease = new AMTween.EasingFunction(AMTween.easeOutCubic); break; case AMTween.EaseType.easeInOutCubic: this.ease = new AMTween.EasingFunction(AMTween.easeInOutCubic); break; case AMTween.EaseType.easeInQuart: this.ease = new AMTween.EasingFunction(AMTween.easeInQuart); break; case AMTween.EaseType.easeOutQuart: this.ease = new AMTween.EasingFunction(AMTween.easeOutQuart); break; case AMTween.EaseType.easeInOutQuart: this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuart); break; case AMTween.EaseType.easeInQuint: this.ease = new AMTween.EasingFunction(AMTween.easeInQuint); break; case AMTween.EaseType.easeOutQuint: this.ease = new AMTween.EasingFunction(AMTween.easeOutQuint); break; case AMTween.EaseType.easeInOutQuint: this.ease = new AMTween.EasingFunction(AMTween.easeInOutQuint); break; case AMTween.EaseType.easeInSine: this.ease = new AMTween.EasingFunction(AMTween.easeInSine); break; case AMTween.EaseType.easeOutSine: this.ease = new AMTween.EasingFunction(AMTween.easeOutSine); break; case AMTween.EaseType.easeInOutSine: this.ease = new AMTween.EasingFunction(AMTween.easeInOutSine); break; case AMTween.EaseType.easeInExpo: this.ease = new AMTween.EasingFunction(AMTween.easeInExpo); break; case AMTween.EaseType.easeOutExpo: this.ease = new AMTween.EasingFunction(AMTween.easeOutExpo); break; case AMTween.EaseType.easeInOutExpo: this.ease = new AMTween.EasingFunction(AMTween.easeInOutExpo); break; case AMTween.EaseType.easeInCirc: this.ease = new AMTween.EasingFunction(AMTween.easeInCirc); break; case AMTween.EaseType.easeOutCirc: this.ease = new AMTween.EasingFunction(AMTween.easeOutCirc); break; case AMTween.EaseType.easeInOutCirc: this.ease = new AMTween.EasingFunction(AMTween.easeInOutCirc); break; case AMTween.EaseType.linear: this.ease = new AMTween.EasingFunction(AMTween.linear); break; case AMTween.EaseType.spring: this.ease = new AMTween.EasingFunction(AMTween.spring); break; case AMTween.EaseType.easeInBounce: this.ease = new AMTween.EasingFunction(AMTween.easeInBounce); break; case AMTween.EaseType.easeOutBounce: this.ease = new AMTween.EasingFunction(AMTween.easeOutBounce); break; case AMTween.EaseType.easeInOutBounce: this.ease = new AMTween.EasingFunction(AMTween.easeInOutBounce); break; case AMTween.EaseType.easeInBack: this.ease = new AMTween.EasingFunction(AMTween.easeInBack); break; case AMTween.EaseType.easeOutBack: this.ease = new AMTween.EasingFunction(AMTween.easeOutBack); break; case AMTween.EaseType.easeInOutBack: this.ease = new AMTween.EasingFunction(AMTween.easeInOutBack); break; case AMTween.EaseType.easeInElastic: this.ease = new AMTween.EasingFunction(AMTween.easeInElastic); break; case AMTween.EaseType.easeOutElastic: this.ease = new AMTween.EasingFunction(AMTween.easeOutElastic); break; case AMTween.EaseType.easeInOutElastic: this.ease = new AMTween.EasingFunction(AMTween.easeInOutElastic); break; case AMTween.EaseType.stayStart: this.ease = new AMTween.EasingFunction(AMTween.stayStart); break; case AMTween.EaseType.stayEnd: this.ease = new AMTween.EasingFunction(AMTween.stayEnd); break; } } public static AMTween.EasingFunction GetEasingFunction(AMTween.EaseType eType) { switch (eType) { case AMTween.EaseType.easeInQuad: return new AMTween.EasingFunction(AMTween.easeInQuad); case AMTween.EaseType.easeOutQuad: return new AMTween.EasingFunction(AMTween.easeOutQuad); case AMTween.EaseType.easeInOutQuad: return new AMTween.EasingFunction(AMTween.easeInOutQuad); case AMTween.EaseType.easeInCubic: return new AMTween.EasingFunction(AMTween.easeInCubic); case AMTween.EaseType.easeOutCubic: return new AMTween.EasingFunction(AMTween.easeOutCubic); case AMTween.EaseType.easeInOutCubic: return new AMTween.EasingFunction(AMTween.easeInOutCubic); case AMTween.EaseType.easeInQuart: return new AMTween.EasingFunction(AMTween.easeInQuart); case AMTween.EaseType.easeOutQuart: return new AMTween.EasingFunction(AMTween.easeOutQuart); case AMTween.EaseType.easeInOutQuart: return new AMTween.EasingFunction(AMTween.easeInOutQuart); case AMTween.EaseType.easeInQuint: return new AMTween.EasingFunction(AMTween.easeInQuint); case AMTween.EaseType.easeOutQuint: return new AMTween.EasingFunction(AMTween.easeOutQuint); case AMTween.EaseType.easeInOutQuint: return new AMTween.EasingFunction(AMTween.easeInOutQuint); case AMTween.EaseType.easeInSine: return new AMTween.EasingFunction(AMTween.easeInSine); case AMTween.EaseType.easeOutSine: return new AMTween.EasingFunction(AMTween.easeOutSine); case AMTween.EaseType.easeInOutSine: return new AMTween.EasingFunction(AMTween.easeInOutSine); case AMTween.EaseType.easeInExpo: return new AMTween.EasingFunction(AMTween.easeInExpo); case AMTween.EaseType.easeOutExpo: return new AMTween.EasingFunction(AMTween.easeOutExpo); case AMTween.EaseType.easeInOutExpo: return new AMTween.EasingFunction(AMTween.easeInOutExpo); case AMTween.EaseType.easeInCirc: return new AMTween.EasingFunction(AMTween.easeInCirc); case AMTween.EaseType.easeOutCirc: return new AMTween.EasingFunction(AMTween.easeOutCirc); case AMTween.EaseType.easeInOutCirc: return new AMTween.EasingFunction(AMTween.easeInOutCirc); case AMTween.EaseType.linear: return new AMTween.EasingFunction(AMTween.linear); case AMTween.EaseType.spring: return new AMTween.EasingFunction(AMTween.spring); case AMTween.EaseType.easeInBounce: return new AMTween.EasingFunction(AMTween.easeInBounce); case AMTween.EaseType.easeOutBounce: return new AMTween.EasingFunction(AMTween.easeOutBounce); case AMTween.EaseType.easeInOutBounce: return new AMTween.EasingFunction(AMTween.easeInOutBounce); case AMTween.EaseType.easeInBack: return new AMTween.EasingFunction(AMTween.easeInBack); case AMTween.EaseType.easeOutBack: return new AMTween.EasingFunction(AMTween.easeOutBack); case AMTween.EaseType.easeInOutBack: return new AMTween.EasingFunction(AMTween.easeInOutBack); case AMTween.EaseType.easeInElastic: return new AMTween.EasingFunction(AMTween.easeInElastic); case AMTween.EaseType.easeOutElastic: return new AMTween.EasingFunction(AMTween.easeOutElastic); case AMTween.EaseType.easeInOutElastic: return new AMTween.EasingFunction(AMTween.easeInOutElastic); case AMTween.EaseType.stayStart: return new AMTween.EasingFunction(AMTween.stayStart); case AMTween.EaseType.stayEnd: return new AMTween.EasingFunction(AMTween.stayEnd); } return new AMTween.EasingFunction(AMTween.linear); } private void UpdatePercentage() { if (this.useRealTime) { this.runningTime += NTime.realtimeSinceStartup - this.lastRealTime; } else { this.runningTime += NTime.deltaTime; } if (this.reverse) { this.percentage = 1f - this.runningTime / this.time; } else { this.percentage = this.runningTime / this.time; } this.lastRealTime = NTime.realtimeSinceStartup; } private float getIncPercentageBy(float _time) { return Mathf.Clamp01((this.runningTime + _time) / this.time); } private void CallBack(string callbackType) { if (this.tweenArguments.Contains(callbackType) && !this.tweenArguments.Contains("ischild")) { GameObject gameObject; if (this.tweenArguments.Contains(callbackType + "target")) { gameObject = (GameObject)this.tweenArguments[callbackType + "target"]; } else { gameObject = base.gameObject; } if (this.tweenArguments[callbackType].GetType() == typeof(string)) { gameObject.SendMessage((string)this.tweenArguments[callbackType], this.tweenArguments[callbackType + "params"], SendMessageOptions.DontRequireReceiver); } else { Debug.LogError("AMTween Error: Callback method references must be passed as a String!"); UnityEngine.Object.Destroy(this); } } } public void Dispose() { for (int i = 0; i < AMTween.tweens_.Count; i++) { Hashtable hashtable = (Hashtable)AMTween.tweens_[i]; if ((string)hashtable["id"] == this.id) { AMTween.tweens_.RemoveAt(i); break; } } this.CameraFadeCleanup(); base.enabled = false; this.isRunning = false; UnityEngine.Object.Destroy(this); } private void ConflictCheck() { Component[] components = base.GetComponents(typeof(AMTween)); foreach (AMTween amtween in components) { if (this != amtween && amtween.isRunning && amtween.type == this.type && amtween.tweenArguments["trackid"] == this.tweenArguments["trackid"] && amtween.delay <= this.delay) { amtween.TweenComplete(true); } } } private void EnableKinematic() { } private void DisableKinematic() { } private void ResumeDelay() { base.StartCoroutine("TweenDelay"); } public static float customEase(float start, float end, float value, AnimationCurve curve) { end -= start; return end * curve.Evaluate(value) + start; } public static float linear(float start, float end, float value, AnimationCurve curve = null) { return Mathf.Lerp(start, end, value); } public static float clerp(float start, float end, float value) { float num = 0f; float num2 = 360f; float num3 = Mathf.Abs((num2 - num) / 2f); float result; if (end - start < -num3) { float num4 = (num2 - start + end) * value; result = start + num4; } else if (end - start > num3) { float num4 = -(num2 - end + start) * value; result = start + num4; } else { result = start + (end - start) * value; } return result; } public static float spring(float start, float end, float value, AnimationCurve curve = null) { value = Mathf.Clamp01(value); value = (Mathf.Sin(value * 3.14159274f * (0.2f + 2.5f * value * value * value)) * Mathf.Pow(1f - value, 2.2f) + value) * (1f + 1.2f * (1f - value)); return start + (end - start) * value; } public static float stayStart(float start, float end, float value, AnimationCurve curve = null) { return start; } public static float stayEnd(float start, float end, float value, AnimationCurve curve = null) { return end; } public static float easeInQuad(float start, float end, float value, AnimationCurve curve = null) { end -= start; return end * value * value + start; } public static float easeOutQuad(float start, float end, float value, AnimationCurve curve = null) { end -= start; return -end * value * (value - 2f) + start; } public static float easeInOutQuad(float start, float end, float value, AnimationCurve curve = null) { value /= 0.5f; end -= start; if (value < 1f) { return end / 2f * value * value + start; } value -= 1f; return -end / 2f * (value * (value - 2f) - 1f) + start; } public static float easeInCubic(float start, float end, float value, AnimationCurve curve = null) { end -= start; return end * value * value * value + start; } public static float easeOutCubic(float start, float end, float value, AnimationCurve curve = null) { value -= 1f; end -= start; return end * (value * value * value + 1f) + start; } public static float easeInOutCubic(float start, float end, float value, AnimationCurve curve = null) { value /= 0.5f; end -= start; if (value < 1f) { return end / 2f * value * value * value + start; } value -= 2f; return end / 2f * (value * value * value + 2f) + start; } public static float easeInQuart(float start, float end, float value, AnimationCurve curve = null) { end -= start; return end * value * value * value * value + start; } public static float easeOutQuart(float start, float end, float value, AnimationCurve curve = null) { value -= 1f; end -= start; return -end * (value * value * value * value - 1f) + start; } public static float easeInOutQuart(float start, float end, float value, AnimationCurve curve = null) { value /= 0.5f; end -= start; if (value < 1f) { return end / 2f * value * value * value * value + start; } value -= 2f; return -end / 2f * (value * value * value * value - 2f) + start; } public static float easeInQuint(float start, float end, float value, AnimationCurve curve = null) { end -= start; return end * value * value * value * value * value + start; } public static float easeOutQuint(float start, float end, float value, AnimationCurve curve = null) { value -= 1f; end -= start; return end * (value * value * value * value * value + 1f) + start; } public static float easeInOutQuint(float start, float end, float value, AnimationCurve curve = null) { value /= 0.5f; end -= start; if (value < 1f) { return end / 2f * value * value * value * value * value + start; } value -= 2f; return end / 2f * (value * value * value * value * value + 2f) + start; } public static float easeInSine(float start, float end, float value, AnimationCurve curve = null) { end -= start; return -end * Mathf.Cos(value / 1f * 1.57079637f) + end + start; } public static float easeOutSine(float start, float end, float value, AnimationCurve curve = null) { end -= start; return end * Mathf.Sin(value / 1f * 1.57079637f) + start; } public static float easeInOutSine(float start, float end, float value, AnimationCurve curve = null) { end -= start; return -end / 2f * (Mathf.Cos(3.14159274f * value / 1f) - 1f) + start; } public static float easeInExpo(float start, float end, float value, AnimationCurve curve = null) { end -= start; return end * Mathf.Pow(2f, 10f * (value / 1f - 1f)) + start; } public static float easeInExpoReveresed(float start, float end, float value, AnimationCurve curve = null) { end -= start; return 1f + Mathf.Log(value - start) / (10f * Mathf.Log(2f)); } public static float easeOutExpo(float start, float end, float value, AnimationCurve curve = null) { end -= start; return end * (-Mathf.Pow(2f, -10f * value / 1f) + 1f) + start; } public static float easeInOutExpo(float start, float end, float value, AnimationCurve curve = null) { value /= 0.5f; end -= start; if (value < 1f) { return end / 2f * Mathf.Pow(2f, 10f * (value - 1f)) + start; } value -= 1f; return end / 2f * (-Mathf.Pow(2f, -10f * value) + 2f) + start; } public static float easeInCirc(float start, float end, float value, AnimationCurve curve = null) { end -= start; return -end * (Mathf.Sqrt(1f - value * value) - 1f) + start; } public static float easeOutCirc(float start, float end, float value, AnimationCurve curve = null) { value -= 1f; end -= start; return end * Mathf.Sqrt(1f - value * value) + start; } public static float easeInOutCirc(float start, float end, float value, AnimationCurve curve = null) { value /= 0.5f; end -= start; if (value < 1f) { return -end / 2f * (Mathf.Sqrt(1f - value * value) - 1f) + start; } value -= 2f; return end / 2f * (Mathf.Sqrt(1f - value * value) + 1f) + start; } public static float easeInBounce(float start, float end, float value, AnimationCurve curve = null) { end -= start; float num = 1f; return end - AMTween.easeOutBounce(0f, end, num - value, null) + start; } public static float easeOutBounce(float start, float end, float value, AnimationCurve curve = null) { value /= 1f; end -= start; if (value < 0.363636374f) { return end * (7.5625f * value * value) + start; } if (value < 0.727272749f) { value -= 0.545454562f; return end * (7.5625f * value * value + 0.75f) + start; } if ((double)value < 0.90909090909090906) { value -= 0.8181818f; return end * (7.5625f * value * value + 0.9375f) + start; } value -= 0.954545438f; return end * (7.5625f * value * value + 0.984375f) + start; } public static float easeInOutBounce(float start, float end, float value, AnimationCurve curve = null) { end -= start; float num = 1f; if (value < num / 2f) { return AMTween.easeInBounce(0f, end, value * 2f, null) * 0.5f + start; } return AMTween.easeOutBounce(0f, end, value * 2f - num, null) * 0.5f + end * 0.5f + start; } public static float easeInBack(float start, float end, float value, AnimationCurve curve = null) { end -= start; value /= 1f; float num = 1.70158f; return end * value * value * ((num + 1f) * value - num) + start; } public static float easeOutBack(float start, float end, float value, AnimationCurve curve = null) { float num = 1.70158f; end -= start; value = value / 1f - 1f; return end * (value * value * ((num + 1f) * value + num) + 1f) + start; } public static float easeInOutBack(float start, float end, float value, AnimationCurve curve = null) { float num = 1.70158f; end -= start; value /= 0.5f; if (value < 1f) { num *= 1.525f; return end / 2f * (value * value * ((num + 1f) * value - num)) + start; } value -= 2f; num *= 1.525f; return end / 2f * (value * value * ((num + 1f) * value + num) + 2f) + start; } public static float punch(float amplitude, float value, AnimationCurve curve = null) { if (value == 0f) { return 0f; } if (value == 1f) { return 0f; } float num = 0.3f; float num2 = num / 6.28318548f * Mathf.Asin(0f); return amplitude * Mathf.Pow(2f, -10f * value) * Mathf.Sin((value * 1f - num2) * 6.28318548f / num); } public static float easeInElastic(float start, float end, float value, AnimationCurve curve = null) { end -= start; float num = 1f; float num2 = num * 0.3f; float num3 = 0f; if (value == 0f) { return start; } if ((value /= num) == 1f) { return start + end; } float num4; if (num3 == 0f || num3 < Mathf.Abs(end)) { num3 = end; num4 = num2 / 4f; } else { num4 = num2 / 6.28318548f * Mathf.Asin(end / num3); } return -(num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2)) + start; } public static float easeOutElastic(float start, float end, float value, AnimationCurve curve = null) { end -= start; float num = 1f; float num2 = num * 0.3f; float num3 = 0f; if (value == 0f) { return start; } if ((value /= num) == 1f) { return start + end; } float num4; if (num3 == 0f || num3 < Mathf.Abs(end)) { num3 = end; num4 = num2 / 4f; } else { num4 = num2 / 6.28318548f * Mathf.Asin(end / num3); } return num3 * Mathf.Pow(2f, -10f * value) * Mathf.Sin((value * num - num4) * 6.28318548f / num2) + end + start; } public static float easeInOutElastic(float start, float end, float value, AnimationCurve curve = null) { end -= start; float num = 1f; float num2 = num * 0.3f; float num3 = 0f; if (value == 0f) { return start; } if ((value /= num / 2f) == 2f) { return start + end; } float num4; if (num3 == 0f || num3 < Mathf.Abs(end)) { num3 = end; num4 = num2 / 4f; } else { num4 = num2 / 6.28318548f * Mathf.Asin(end / num3); } if (value < 1f) { return -0.5f * (num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2)) + start; } return num3 * Mathf.Pow(2f, -10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * 6.28318548f / num2) * 0.5f + end + start; } public static ArrayList tweens_ = new ArrayList(); public static ArrayList disabledTweens = new ArrayList(); private static GameObject cameraFade; public string id; public string type; public string method; public AMTween.EaseType easeType; public AnimationCurve easeCurve; public float time; public float delay; public AMTween.LoopType loopType; public bool isRunning; public bool isPaused; public string _name; private float runningTime; private float percentage; private float delayStarted; private bool kinematic; private bool isLocal; private bool loop; private bool reverse; private bool wasPaused; private bool physics; private Hashtable tweenArguments; private Space space; private AMTween.EasingFunction ease; private AMTween.ApplyTween apply; private AudioSource audioSource; private Vector3[] vector3s; private Vector2[] vector2s; private Color[,] colors; private float[] floats; private Rect[] rects; private float[] startMorphs; private float[] endMorphs; private float[] currentMorphs; private AMTween.CRSpline path; private Vector3 preUpdate; private Vector3 postUpdate; private AMTween.NamedValueColor namedcolorvalue; private float lastRealTime; private bool useRealTime; public static string[] TransitionNamesDict = new string[] { "Crossfade", "Venetian Blinds", "Doors", "Iris Box", "Iris Round", "None", "Iris Shape", "Shape Wipe", "Linear Wipe", "Radial Wipe", "Wedge Wipe" }; public static string[] TransitionNames = new string[] { "None", "Crossfade", "Doors", "Venetian Blinds", "Iris Box", "Iris Round", "Iris Shape", "Linear Wipe", "Shape Wipe", "Radial Wipe", "Wedge Wipe" }; public static int[] TransitionOrder = new int[] { 5, 0, 2, 1, 3, 4, 6, 8, 7, 9, 10 }; public delegate float EasingFunction(float start, float end, float value, AnimationCurve curve); private delegate void ApplyTween(); public enum EaseType { easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, linear, spring, easeInBounce, easeOutBounce, easeInOutBounce, easeInBack, easeOutBack, easeInOutBack, easeInElastic, easeOutElastic, easeInOutElastic, punch, stayStart, stayEnd } public enum LoopType { none, loop, pingPong } public enum NamedValueColor { _Color, _SpecColor, _Emission, _ReflectColor } public enum Fade { CrossFade, VenetianBlinds, Doors, IrisBox, IrisRound, None, IrisShape, ShapeWipe, LinearWipe, RadialWipe, WedgeWipe } public static class Defaults { public static float time = 1f; public static float delay = 0f; public static AMTween.NamedValueColor namedColorValue = AMTween.NamedValueColor._Color; public static AMTween.LoopType loopType = AMTween.LoopType.none; public static AMTween.EaseType easeType = AMTween.EaseType.easeOutExpo; public static float lookSpeed = 3f; public static bool isLocal = false; public static Space space = Space.Self; public static bool orientToPath = false; public static Color color = Color.white; public static float updateTimePercentage = 0.05f; public static float updateTime = 1f * AMTween.Defaults.updateTimePercentage; public static int cameraFadeDepth = 999999; public static float lookAhead = 0.05f; public static bool useRealTime = false; public static Vector3 up = Vector3.up; } private class CRSpline { public CRSpline(params Vector3[] pts) { this.pts = new Vector3[pts.Length]; Array.Copy(pts, this.pts, pts.Length); } public Vector3 Interp(float t) { int num = this.pts.Length - 3; int num2 = Mathf.Min(Mathf.FloorToInt(t * (float)num), num - 1); float num3 = t * (float)num - (float)num2; Vector3 a = this.pts[num2]; Vector3 a2 = this.pts[num2 + 1]; Vector3 vector = this.pts[num2 + 2]; Vector3 b = this.pts[num2 + 3]; return 0.5f * ((-a + 3f * a2 - 3f * vector + b) * (num3 * num3 * num3) + (2f * a - 5f * a2 + 4f * vector - b) * (num3 * num3) + (-a + vector) * num3 + 2f * a2); } public Vector3[] pts; } }