private static bool parsePlayAudio(JSONAction a)
    {
        //AMTween.PlayAudio(audioSource, AMTween.Hash ("delay", getWaitTime(frameRate), "audioclip", audioClip, "loop", loop));
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        if (a.strings.Length >= 1)
        {
            AudioClip audioClip = (AudioClip)Resources.Load(a.strings[0]);
            if (audioClip == null)
            {
                Debug.LogWarning("Animator: Could not find AudioClip '" + a.strings[0] + "'. Make sure the audio file is placed in a Resources folder!");
                return(false);
            }
            hash.Add("audioclip", audioClip);
        }
        else
        {
            Debug.LogWarning("Animator: PlayAudio missing 'audioclip' clip name.");
            return(false);
        }
        if (a.bools.Length >= 1)
        {
            hash.Add("loop", a.bools[0]);
        }
        else
        {
            Debug.LogWarning("Animator: PlayAudio missing 'loop'.");
            return(false);
        }
        AMTween.PlayAudio((AudioSource)getCMP(a.go, "AudioSource"), hash);
        return(true);
    }
Exemple #2
0
        public override void execute(int frameRate, float delay)
        {
            if (!obj)
            {
                return;
            }
            if (endFrame == -1)
            {
                return;
            }

            //var tr = obj.transform;

            if (hasCustomEase())
            {
                AMTween.ScaleTo(obj.gameObject, AMTween.Hash(
                                    "delay", getWaitTime(frameRate, delay),
                                    "time", getTime(frameRate),
                                    "scale", endScale,
                                    "easecurve", easeCurve)
                                );
            }
            else
            {
                AMTween.ScaleTo(obj.gameObject, AMTween.Hash(
                                    "delay", getWaitTime(frameRate, delay),
                                    "time", getTime(frameRate),
                                    "scale", endScale,
                                    "easetype", (AMTween.EaseType)easeType
                                    )
                                );
            }
        }
    private static bool parseInvokeMethod(JSONAction a)
    {
        if (a.strings == null || a.strings.Length < 2)
        {
            Debug.LogWarning("Animator: SendMessage missing Component or MethodInfo Name.");
            return(false);
        }
        //AMTween.InvokeMethod(component,AMTween.Hash ("delay",getWaitTime(frameRate),"methodinfo",methodInfo,"parameters",arrParams));
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        hash.Add("methodinfo", getMethodInfo(a.go, a.strings[0], a.strings[1], null));
        if (a.eventParams != null && a.eventParams.Length > 0)
        {
            object[] arrParams = new object[a.eventParams.Length];
            for (int i = 0; i < a.eventParams.Length; i++)
            {
                arrParams[i] = a.eventParams[i].toObject();
            }
            if (arrParams.Length <= 0)
            {
                arrParams = null;
            }
            hash.Add("parameters", arrParams);
        }
        AMTween.InvokeMethod(getCMP(a.go, a.strings[0]), hash);
        return(true);
    }
    void Update()
    {
        percent += 0.003f * speedValues[selectedSpeedIndex];
        if (percent > 1f + waitPercent)
        {
            percent = waitPercent * -1f;
        }
        float x_pos_start = 50f;
        float x_pos_end   = position.width - 50f - 80f - 200f;

        if (percent <= 1f)
        {
            AMTween.EasingFunction ease;
            AnimationCurve         _curve = null;
            if (isCustomEase)
            {
                _curve = curve;
                ease   = AMTween.customEase;
            }
            else
            {
                ease = AMTween.GetEasingFunction((AMTween.EaseType)getSelectedEaseIndex(category, selectedIndex));
            }
            x_pos = ease(x_pos_start, x_pos_end, (percent < 0f ? 0f : percent), _curve);
        }
        this.Repaint();
    }
 public override void execute(int frameRate, float delay)
 {
     if (!obj)
     {
         return;
     }
     if (endFrame == -1)
     {
         return;
     }
     // if start and end target are the same, look follow
     if (isLookFollow())
     {
         AMTween.LookFollow(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "looktarget", startTarget));
         // look to follow
     }
     else
     {
         if (hasCustomEase())
         {
             AMTween.LookToFollow(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "looktarget", endTarget, "endposition", (isSetEndPosition ? (Vector3?)endPosition : null), "easecurve", easeCurve));
         }
         else
         {
             AMTween.LookToFollow(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "looktarget", endTarget, "endposition", (isSetEndPosition ? (Vector3?)endPosition : null), "easetype", (AMTween.EaseType)easeType));
         }
     }
 }
Exemple #6
0
    public void Execute(AMTake take, bool isFrame = true, float value = 0f /* frame or time */)
    {
        if (nowPlayingTake != null)
        {
            AMTween.Stop();
        }

        take.rebind(rebindOption);

        // delete AMCameraFade
        float startFrame = value;
        float startTime  = value;

        if (!isFrame)
        {
            startFrame *= take.frameRate;                       // convert time to frame
        }
        if (isFrame)
        {
            startTime /= take.frameRate;                        // convert frame to time
        }
        take.executeActions(startFrame);
        elapsedTime    = startTime;
        takeTime       = (float)take.numFrames / (float)take.frameRate;
        nowPlayingTake = take;

        take.unbind(rebindOption);
    }
    // preview a frame in the scene view
    public override void previewFrame(float frame, AMTrack extraTrack = null)
    {
        if (!obj)
        {
            return;
        }
        if (cache.Count <= 0)
        {
            return;
        }
        // if before first frame
        if (frame <= (float)cache[0].startFrame)
        {
            obj.position = (cache[0] as AMTranslationAction).path[0];
            return;
        }
        // if beyond last frame
        if (frame >= (float)(cache[cache.Count - 1] as AMTranslationAction).endFrame)
        {
            obj.position = (cache[cache.Count - 1] as AMTranslationAction).path[(cache[cache.Count - 1] as AMTranslationAction).path.Length - 1];
            return;
        }
        // if lies on curve
        foreach (AMTranslationAction action in cache)
        {
            if (((int)frame < action.startFrame) || ((int)frame > action.endFrame))
            {
                continue;
            }
            if (action.path.Length == 1)
            {
                obj.position = action.path[0];
                return;
            }
            float _value;
            float framePositionInPath = frame - (float)action.startFrame;
            if (framePositionInPath < 0f)
            {
                framePositionInPath = 0f;
            }

            AMTween.EasingFunction ease;
            AnimationCurve         curve = null;

            if (action.hasCustomEase())
            {
                ease  = AMTween.customEase;
                curve = action.easeCurve;
            }
            else
            {
                ease = AMTween.GetEasingFunction((AMTween.EaseType)action.easeType);
            }

            _value = ease(0f, 1f, framePositionInPath / action.getNumberOfFrames(), curve);

            AMTween.PutOnPath(obj, action.path, Mathf.Clamp(_value, 0f, 1f));
            return;
        }
    }
 public override void execute(int frameRate, float delay)
 {
     if (!amClip || !obj)
     {
         return;
     }
     AMTween.PlayAnimation(obj, AMTween.Hash("delay", getWaitTime(frameRate, delay), "animation", amClip.name, "wrapmode", wrapMode, "crossfade", crossfade, "fadeLength", crossfadeTime));
 }
 public override void execute(int frameRate, float delay)
 {
     if (!audioSource || !audioClip)
     {
         return;
     }
     AMTween.PlayAudio(audioSource, AMTween.Hash("delay", getWaitTime(frameRate, delay), "audioclip", audioClip, "loop", loop));
 }
Exemple #10
0
 public void ResumeLoop()
 {
     if (nowPlayingTake == null)
     {
         return;
     }
     AMTween.Resume();
     isPaused = false;
 }
        // preview a frame in the scene view
        public override void previewFrame(float frame, AMTrack extraTrack = null)
        {
            if (!obj)
            {
                return;
            }
            if (cache.Count <= 1)
            {
                return;
            }
            // if before first frame
            if (frame <= (float)cache[0].startFrame)
            {
                obj.localScale = (cache[0] as AMScaleAction).startScale;
                return;
            }
            // if beyond last frame
            if (frame >= (float)(cache[cache.Count - 2] as AMScaleAction).endFrame)
            {
                obj.localScale = (cache[cache.Count - 2] as AMScaleAction).endScale;
                return;
            }
            // if lies on curve
            for (int i = 0; i <= cache.Count - 2; ++i)
            {
                AMScaleAction action = cache[i] as AMScaleAction;
                if (((int)frame < action.startFrame) || ((int)frame > action.endFrame))
                {
                    continue;
                }

                float _value;
                float framePositionInPath = frame - (float)action.startFrame;
                if (framePositionInPath < 0f)
                {
                    framePositionInPath = 0f;
                }

                AMTween.EasingFunction ease;
                AnimationCurve         curve = null;

                if (action.hasCustomEase())
                {
                    ease  = AMTween.customEase;
                    curve = action.easeCurve;
                }
                else
                {
                    ease = AMTween.GetEasingFunction((AMTween.EaseType)action.easeType);
                }

                _value = ease(0f, 1f, framePositionInPath / action.getNumberOfFrames(), curve);

                obj.localScale = Vector3.Lerp(action.startScale, action.endScale, _value);
                return;
            }
        }
    private static bool parseCameraFade(JSONAction a)
    {
        if (a.ints == null || a.ints.Length < 3)
        {
            Debug.LogWarning("Animator: CameraFade missing fade type, start or end targets.");
            return(false);
        }
        if (a.strings == null || a.strings.Length < 2 || a.colors == null || a.colors.Length < 2)
        {
            Debug.LogWarning("Animator: CameraFade missing start or end targets.");
            return(false);
        }
        Hashtable hash = new Hashtable();

        hash.Add("time", a.time);
        hash.Add("delay", a.delay);
        setupHashEase(hash, a);
        if (a.bools != null && a.bools.Length > 0)
        {
            hash.Add("reversed", a.bools[0]);
        }
        if (a.ints[1] == 0 || a.ints[2] == 0)
        {
            hash.Add("allcameras", allCameras);
        }
        if (a.stringsExtra != null && a.stringsExtra.Length > 0)
        {
            hash.Add("texture", AMTween.LoadTexture2D(a.stringsExtra[0]));
        }
        if (a.ints[1] == 0)
        {
            hash.Add("camera1", getGO(a.strings[0]).GetComponent <Camera>());
        }
        else
        {
            hash.Add("color1", a.colors[0].toColor());
        }
        if (a.ints[2] == 0)
        {
            hash.Add("camera2", getGO(a.strings[1]).GetComponent <Camera>());
        }
        else
        {
            hash.Add("color2", a.colors[1].toColor());
        }

        float[] parameters = a.floats;
        if (parameters == null)
        {
            parameters = new float[] {}
        }
        ;

        AMTween.CameraFade(a.ints[0], (a.bools == null || a.bools.Length < 2 ? false : a.bools[1]), parameters, hash);
        return(true);
    }
Exemple #13
0
 public void PauseLoop()
 {
     if (nowPlayingTake == null)
     {
         return;
     }
     isPaused = true;
     nowPlayingTake.stopAudio();
     AMTween.Pause();
 }
Exemple #14
0
 public override void execute(int frameRate, float delay)
 {
     if (!audioSource || !audioClip)
     {
         CoroutineBehaviour.StartCoroutineDelay(audioSource.gameObject, _StopClip, getWaitTime(frameRate, delay));
     }
     else
     {
         AMTween.PlayAudio(audioSource, AMTween.Hash("delay", getWaitTime(frameRate, delay), "audioclip", audioClip, "loop", loop));
     }
 }
 private static void setupHashEase(Hashtable hashTable, AnimatorTimeline.JSONAction a)
 {
     if (a.customEase.Length > 0)
     {
         AnimationCurve easeCurve = AMTween.GenerateCurve(a.customEase);
         hashTable.Add("easecurve", easeCurve);
     }
     else
     {
         hashTable.Add("easetype", (AMTween.EaseType)a.easeType);
     }
 }
Exemple #16
0
    // set render texture or colors if render texture is used (stills handled in AMTake)
    private void setRenderTexture(AMCameraFade cf, float frame, int firstTargetType, int secondTargetType, bool isReversed, AMCameraSwitcherAction action, bool isPreview)
    {
        Camera firstCamera  = (isReversed ? action.endCamera : action.startCamera);
        Camera secondCamera = (isReversed ? action.startCamera : action.endCamera);

        if (isReversed && frame == action.startFrame)
        {
            if (firstTargetType == 0)
            {
                AMTween.SetTopCamera(firstCamera, cachedAllCameras);
            }
        }
        else
        {
            if (secondTargetType == 0)
            {
                AMTween.SetTopCamera(secondCamera, cachedAllCameras);
            }
        }

        if (action.still || (firstTargetType != 0 && secondTargetType != 0))
        {
            return;
        }

        bool isPro = AMTake.isProLicense;

        // first target is camera, set render texture
        if (firstTargetType == 0)
        {
            // if should update render texture
            if (/*!cf.tex ||*/ cf.shouldUpdateRenderTexture || (isPro && (!firstCamera.targetTexture || !cf.isRenderTextureSetupFor(firstCamera) /*|| firstCamera.targetTexture != cf.tex*/)))
            {
                if (isPro)
                {
                    cf.setupRenderTexture(firstCamera);
                }
                else
                {
                    cf.useRenderTexture = false;
                    // show place-holder if non-pro
                    cf.colorTex    = Color.white;
                    cf.tex2d       = (Texture2D)Resources.Load("am_indie_placeholder");
                    cf.hasColorTex = false;
                    if (!cf.placeholder)
                    {
                        cf.placeholder = true;
                    }
                }
            }
        }
    }
 // draw gizmos
 public override void drawGizmos(float gizmo_size)
 {
     foreach (AMTranslationAction action in cache)
     {
         if (action.path.Length > 1)
         {
             AMTween.DrawPath(action.path, new Color(255f, 255f, 255f, .5f));
             Gizmos.color = Color.green;
             Gizmos.DrawSphere(action.path[0], gizmo_size);
             Gizmos.DrawSphere(action.path[action.path.Length - 1], gizmo_size);
         }
     }
 }
Exemple #18
0
 public void StopLoop()
 {
     if (nowPlayingTake == null)
     {
         return;
     }
     nowPlayingTake.stopAudio();
     nowPlayingTake.stopAnimations();
     nowPlayingTake = null;
     isLooping      = false;
     isPaused       = false;
     AMTween.Stop();
 }
    public Vector3 getPositionAtFrame(float frame)
    {
        if (cache.Count <= 0)
        {
            return(obj.position);
        }
        // if before first frame
        if (frame <= (float)cache[0].startFrame)
        {
            return((cache[0] as AMTranslationAction).path[0]);
        }
        // if beyond last frame
        if (frame >= (float)(cache[cache.Count - 1] as AMTranslationAction).endFrame)
        {
            return((cache[cache.Count - 1] as AMTranslationAction).path[(cache[cache.Count - 1] as AMTranslationAction).path.Length - 1]);
        }
        // if lies on curve
        foreach (AMTranslationAction action in cache)
        {
            if (((int)frame < action.startFrame) || ((int)frame > action.endFrame))
            {
                continue;
            }
            if (action.path.Length == 1)
            {
                return(action.path[0]);
            }
            // ease
            AMTween.EasingFunction ease;
            AnimationCurve         curve = null;

            if (action.hasCustomEase())
            {
                ease  = AMTween.customEase;
                curve = action.easeCurve;
            }
            else
            {
                ease = AMTween.GetEasingFunction((AMTween.EaseType)action.easeType);
            }
            float framePositionInPath = frame - (float)action.startFrame;
            if (framePositionInPath < 0f)
            {
                framePositionInPath = 0f;
            }
            return(AMTween.PointOnPath(action.path, Mathf.Clamp(ease(0f, 1f, framePositionInPath / action.getNumberOfFrames(), curve), 0f, 1f)));
        }
        Debug.LogError("Animator: Could not get " + obj.name + " position at frame '" + frame + "'");
        return(new Vector3(0f, 0f, 0f));
    }
    public Quaternion getQuaternionAtPercent(float percentage, /*Vector3 startPosition, Vector3 endPosition,*/ Vector3?startVector = null, Vector3?endVector = null)
    {
        if (isLookFollow())
        {
            obj.LookAt(startTarget);
            return(obj.rotation);
        }

        Vector3 _temp = obj.position;

        if (isSetStartPosition)
        {
            obj.position = (Vector3)startPosition;
        }
        obj.LookAt(startVector ?? startTarget.position);
        Vector3 eStart = obj.eulerAngles;

        if (isSetEndPosition)
        {
            obj.position = (Vector3)endPosition;
        }
        obj.LookAt(endVector ?? endTarget.position);
        Vector3 eEnd = obj.eulerAngles;

        obj.position = _temp;
        eEnd         = new Vector3(AMTween.clerp(eStart.x, eEnd.x, 1), AMTween.clerp(eStart.y, eEnd.y, 1), AMTween.clerp(eStart.z, eEnd.z, 1));

        Vector3 eCurrent = new Vector3();

        AMTween.EasingFunction ease;
        AnimationCurve         curve = null;

        if (hasCustomEase())
        {
            curve = easeCurve;
            ease  = AMTween.customEase;
        }
        else
        {
            ease = AMTween.GetEasingFunction((AMTween.EaseType)easeType);
        }

        eCurrent.x = ease(eStart.x, eEnd.x, percentage, curve);
        eCurrent.y = ease(eStart.y, eEnd.y, percentage, curve);
        eCurrent.z = ease(eStart.z, eEnd.z, percentage, curve);


        return(Quaternion.Euler(eCurrent));
    }
Exemple #21
0
    public void execute(int frameRate, float delay, Camera[] allCameras)
    {
        // if targets are equal do nothing
        if (endFrame == -1 || !hasTargets() || targetsAreEqual())
        {
            return;
        }
        float[]   parameters = cameraFadeParameters.ToArray();
        Hashtable hash       = new Hashtable();

        hash.Add("time", getTime(frameRate));
        hash.Add("delay", getWaitTime(frameRate, delay));
        if (easeType == 32)
        {
            hash.Add("easecurve", easeCurve);
        }
        else
        {
            hash.Add("easetype", (AMTween.EaseType)easeType);
        }
        hash.Add("reversed", AMTween.isTransitionReversed(cameraFadeType, parameters));
        hash.Add("allcameras", allCameras);
        if (startTargetType == 0)
        {
            hash.Add("camera1", startCamera);
        }
        else
        {
            hash.Add("color1", startColor);
        }
        if (endTargetType == 0)
        {
            hash.Add("camera2", endCamera);
        }
        else
        {
            hash.Add("color2", endColor);
        }
        if (AMCameraFade.needsTexture(cameraFadeType))
        {
            hash.Add("texture", irisShape);
        }
        AMTween.CameraFade(cameraFadeType, !still, parameters, hash);
    }
Exemple #22
0
    public void destroy()
    {
        AMTween.Stop(this.gameObject);
        if (_tex)
        {
            if (renderTextureCamera && renderTextureCamera.targetTexture == _tex)
            {
                renderTextureCamera.targetTexture = null;
            }
            Destroy(_tex);
        }

        /*if(_matIris) {
         *      Destroy(_matIris.shader);
         *      Destroy(_matIris);
         * }*/
        _cf = null;
        Destroy(this.gameObject);
    }
 public override void execute(int frameRate, float delay)
 {
     if (!obj)
     {
         return;
     }
     if (endFrame == -1)
     {
         return;
     }
     if (hasCustomEase())
     {
         AMTween.RotateTo(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "rotation", endRotation.eulerAngles, "easecurve", easeCurve));
     }
     else
     {
         AMTween.RotateTo(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "rotation", endRotation.eulerAngles, "easetype", (AMTween.EaseType)easeType));
     }
 }
    private static bool parseLookFollow(JSONAction a)
    {
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        hash.Add("time", a.time);
        setupHashEase(hash, a);
        if (a.strings.Length >= 1)
        {
            hash.Add("looktarget", getGO(a.strings[0]).transform);                              // move to position
        }
        else
        {
            Debug.LogWarning("Animator: LookFollow missing 'looktarget'.");
            return(false);
        }
        AMTween.LookFollow(getGO(a.go), hash);
        return(true);
    }
    private static bool parseRotateTo(JSONAction a)
    {
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        hash.Add("time", a.time);
        setupHashEase(hash, a);
        if (a.path.Length >= 1)
        {
            hash.Add("rotation", a.path[0].toVector3());                           // rotate to eulerAngle
        }
        else
        {
            Debug.LogWarning("Animator: RotateTo missing 'rotation'.");
            return(false);
        }
        AMTween.RotateTo(getGO(a.go), hash);
        return(true);
    }
    private static bool parseSendMessage(JSONAction a)
    {
        if (a.strings == null || a.strings.Length < 1)
        {
            Debug.LogWarning("Animator: SendMessage missing Method Name.");
            return(false);
        }
        //AMTween.SendMessage(component.gameObject, AMTween.Hash ("delay", getWaitTime(frameRate), "methodname", methodName, "parameter", parameters[0].toObject()));
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        hash.Add("methodname", a.strings[0]);
        if (a.eventParams != null && a.eventParams.Length > 0)
        {
            hash.Add("parameter", a.eventParams[0].toObject());
        }
        AMTween.SendMessage(getGO(a.go), hash);
        return(true);
    }
Exemple #27
0
 public override void execute(int frameRate, float delay)
 {
     if (useSendMessage)
     {
         if (component == null || methodName == null)
         {
             return;
         }
         if (parameters == null || parameters.Count <= 0)
         {
             AMTween.SendMessage(component.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "methodname", methodName));
         }
         else
         {
             AMTween.SendMessage(component.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "methodname", methodName, "parameter", parameters[0].toObject()));
         }
         return;
     }
     if (component == null || methodInfo == null)
     {
         return;
     }
     object[] arrParams = new object[parameters.Count];
     for (int i = 0; i < parameters.Count; i++)
     {
         if (parameters[i].isArray())
         {
             setObjectInArray(ref arrParams[i], parameters[i].lsArray);
         }
         else
         {
             arrParams[i] = parameters[i].toObject();
         }
     }
     if (arrParams.Length <= 0)
     {
         arrParams = null;
     }
     AMTween.InvokeMethod(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "methodinfo", methodInfo, "parameters", arrParams));
 }
    private static bool parsePlayAnimation(JSONAction a)
    {
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        if (a.strings.Length >= 1)
        {
            hash.Add("animation", a.strings[0]);
        }
        else
        {
            Debug.LogWarning("Animator: PlayAnimation missing 'animation' clip name.");
            return(false);
        }
        if (a.floats.Length >= 2)
        {
            hash.Add("wrapmode", (WrapMode)a.floats[0]);
            hash.Add("fadeLength", a.floats[1]);
        }
        else
        {
            Debug.LogWarning("Animator: PlayAnimation missing 'wrapmode' or 'fadeLength'.");
            return(false);
        }
        if (a.bools.Length >= 1)
        {
            hash.Add("crossfade", a.bools[0]);
        }
        else
        {
            Debug.LogWarning("Animator: PlayAnimation missing 'crossfade'.");
            return(false);
        }
        AMTween.PlayAnimation(getGO(a.go), hash);
        return(true);
    }
Exemple #29
0
 public override void execute(int frameRate, float delay)
 {
     if (!obj)
     {
         return;
     }
     if (path.Length <= 1)
     {
         return;
     }
     if (getNumberOfFrames() <= 0)
     {
         return;
     }
     // if line
     if (path.Length == 2)
     {
         if (hasCustomEase())
         {
             AMTween.MoveTo(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "position", path[1], "easecurve", easeCurve));
         }
         else
         {
             AMTween.MoveTo(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "position", path[1], "easetype", (AMTween.EaseType)easeType));
         }
         return;
     }
     // if curve
     if (hasCustomEase())
     {
         AMTween.MoveTo(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "path", path, "easecurve", easeCurve));
     }
     else
     {
         AMTween.MoveTo(obj.gameObject, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "path", path, "easetype", (AMTween.EaseType)easeType));
     }
 }
    private static bool parseMoveTo(JSONAction a)
    {
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        hash.Add("time", a.time);
        setupHashEase(hash, a);
        if (a.path.Length > 1)
        {
            hash.Add("path", a.getVector3Path());                          // move to position
        }
        else if (a.path.Length == 1)
        {
            hash.Add("position", a.path[0].toVector3());                                 // move with path
        }
        else
        {
            Debug.LogWarning("Animator: MoveTo missing 'position' or 'path'.");
            return(false);
        }
        AMTween.MoveTo(getGO(a.go), hash);
        return(true);
    }
 public AnimationCurve getCurve(AMTween.EaseType easeType)
 {
     AnimationCurve _curve = new AnimationCurve();
     switch(easeType)
     {
         case AMTween.EaseType.linear:
             _curve.AddKey(new Keyframe(0f,0f,1f,1f));
             _curve.AddKey(new Keyframe(1f,1f,1f,1f));
             break;
         case AMTween.EaseType.easeInQuad:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(1f,1f,2f,2f));
             break;
         case AMTween.EaseType.easeOutQuad:
             _curve.AddKey(new Keyframe(0f,0f,2f,2f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInOutQuad:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,2f,2f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInCubic:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(1f,1f,3f,3f));
             break;
         case AMTween.EaseType.easeOutCubic:
             _curve.AddKey(new Keyframe(0f,0f,3f,3f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInOutCubic:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,3f,3f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInQuart:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.5f,0.064f,0.5f,0.5f));
             _curve.AddKey(new Keyframe(1f,1f,4f,4f));
             break;
         case AMTween.EaseType.easeOutQuart:
             _curve.AddKey(new Keyframe(0f,0f,4f,4f));
             _curve.AddKey(new Keyframe(0.5f,0.936f,0.5f,0.5f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInOutQuart:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.25f,0.032f,0.5f,0.5f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,4f,4f));
             _curve.AddKey(new Keyframe(0.75f,0.968f,0.5f,0.5f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInQuint:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.2f,0f,0.033f,0.033f));
             _curve.AddKey(new Keyframe(0.6f,0.077f,0.65f,0.65f));
             _curve.AddKey(new Keyframe(1f,1f,5f,5f));
             break;
         case AMTween.EaseType.easeOutQuint:
             _curve.AddKey(new Keyframe(0f,0f,5f,5f));
             _curve.AddKey(new Keyframe(0.4f,0.92f,0.65f,0.65f));
             _curve.AddKey(new Keyframe(0.8f,1f,0.033f,0.033f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInOutQuint:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.1f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.3f,0.04f,0.65f,0.65f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,5f,5f));
             _curve.AddKey(new Keyframe(0.7f,0.96f,0.65f,0.65f));
             _curve.AddKey(new Keyframe(0.9f,1f,0f,0f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInSine:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.5f,0.292f,1.11f,1.11f));
             _curve.AddKey(new Keyframe(1f,1f,1.56f,1.56f));
             break;
         case AMTween.EaseType.easeOutSine:
             _curve.AddKey(new Keyframe(0f,0f,1.56f,1.56f));
             _curve.AddKey(new Keyframe(0.5f,0.708f,1.11f,1.11f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInOutSine:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.25f,0.145f,1.1f,1.1f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,1.6f,1.6f));
             _curve.AddKey(new Keyframe(0.75f,0.853f,1.1f,1.1f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInExpo:
             _curve.AddKey(new Keyframe(0f,0f,0.031f,0.031f));
             _curve.AddKey(new Keyframe(0.5f,0.031f,0.214f,0.214f));
             _curve.AddKey(new Keyframe(0.8f,0.249f,1.682f,1.682f));
             _curve.AddKey(new Keyframe(1f,1f,6.8f,6.8f));
             break;
         case AMTween.EaseType.easeOutExpo:
             _curve.AddKey(new Keyframe(0f,0f,6.8f,6.8f));
             _curve.AddKey(new Keyframe(0.2f,0.751f,1.682f,1.682f));
             _curve.AddKey(new Keyframe(0.5f,0.969f,0.214f,0.214f));
             _curve.AddKey(new Keyframe(1f,1f,0.031f,0.031f));
             break;
         case AMTween.EaseType.easeInOutExpo:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.25f,0.015f,0.181f,0.181f));
             _curve.AddKey(new Keyframe(0.4f,0.125f,1.58f,1.58f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,6.8f,6.8f));
             _curve.AddKey(new Keyframe(0.6f,0.873f,1.682f,1.682f));
             _curve.AddKey(new Keyframe(0.75f,0.982f,0.21f,0.21f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInCirc:
             _curve.AddKey(new Keyframe(0f,0f,0.04f,0.04f));
             _curve.AddKey(new Keyframe(0.6f,0.2f,0.76f,0.76f));
             _curve.AddKey(new Keyframe(0.9f,0.562f,1.92f,1.92f));
             _curve.AddKey(new Keyframe(0.975f,0.78f,4.2f,4.2f));
             _curve.AddKey(new Keyframe(1f,1f,17.3f,17.3f));
             break;
         case AMTween.EaseType.easeOutCirc:
             _curve.AddKey(new Keyframe(0f,0f,17.3f,17.3f));
             _curve.AddKey(new Keyframe(0.025f,0.22f,4.2f,4.2f));
             _curve.AddKey(new Keyframe(0.1f,0.438f,1.92f,1.92f));
             _curve.AddKey(new Keyframe(0.4f,0.8f,0.76f,0.76f));
             _curve.AddKey(new Keyframe(1f,1f,0.04f,0.04f));
             break;
         case AMTween.EaseType.easeInOutCirc:
             _curve.AddKey(new Keyframe(0f,0f,0f,0f));
             _curve.AddKey(new Keyframe(0.3f,0.098f,0.75f,0.75f));
             _curve.AddKey(new Keyframe(0.45f,0.281f,1.96f,1.96f));
             _curve.AddKey(new Keyframe(0.4875f,0.392f,4.4f,4.4f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,8.14f,8.14f));
             _curve.AddKey(new Keyframe(0.5125f,0.607f,4.3f,4.3f));
             _curve.AddKey(new Keyframe(0.55f,0.717f,1.94f,1.94f));
             _curve.AddKey(new Keyframe(0.7f,0.899f,0.74f,0.74f));
             _curve.AddKey(new Keyframe(1f,1f,0f,0f));
             break;
         case AMTween.EaseType.easeInBounce:
             _curve.AddKey(new Keyframe(0f,0f,0.715f,0.715f));
             _curve.AddKey(new Keyframe(0.091f,0f,-0.677f,1.365f));
             _curve.AddKey(new Keyframe(0.272f,0f,-1.453f,2.716f));
             _curve.AddKey(new Keyframe(0.636f,0f,-2.775f,5.517f));
             _curve.AddKey(new Keyframe(1f,1f,-0.0023f,-0.0023f));
             break;
         case AMTween.EaseType.easeOutBounce:
             _curve.AddKey(new Keyframe(0f,0f,-0.042f,-0.042f));
             _curve.AddKey(new Keyframe(0.364f,1f,5.414f,-2.758f));
             _curve.AddKey(new Keyframe(0.727f,1f,2.773f,-1.295f));
             _curve.AddKey(new Keyframe(0.909f,1f,1.435f,-0.675f));
             _curve.AddKey(new Keyframe(1f,1f,0.735f,0.735f));
             break;
         case AMTween.EaseType.easeInOutBounce:
             _curve.AddKey(new Keyframe(0f,0f,0.682f,0.682f));
             _curve.AddKey(new Keyframe(0.046f,0f,-0.732f,1.316f));
             _curve.AddKey(new Keyframe(0.136f,0f,-1.568f,2.608f));
             _curve.AddKey(new Keyframe(0.317f,0f,-2.908f,5.346f));
             _curve.AddKey(new Keyframe(0.5f,0.5f,-0.061f,0.007f));
             _curve.AddKey(new Keyframe(0.682f,1f,5.463f,-2.861f));
             _curve.AddKey(new Keyframe(0.864f,1f,2.633f,-1.258f));
             _curve.AddKey(new Keyframe(0.955f,1f,1.488f,-0.634f));
             _curve.AddKey(new Keyframe(1f,1f,0.804f,0.804f));
             break;
         case AMTween.EaseType.easeInBack:
             _curve.AddKey(new Keyframe(0.00f,0.00f,0.00f,0.00f));
             _curve.AddKey(new Keyframe(1.00f,1.00f,4.71f,4.71f));
             break;
         case AMTween.EaseType.easeOutBack:
             _curve.AddKey(new Keyframe(0.00f,0.00f,4.71f,4.71f));
             _curve.AddKey(new Keyframe(1.00f,1.00f,0.00f,0.00f));
             break;
         case AMTween.EaseType.easeInOutBack:
             _curve.AddKey(new Keyframe(0.00f,0.00f,0.00f,0.00f));
             _curve.AddKey(new Keyframe(0.50f,0.50f,5.61f,5.61f));
             _curve.AddKey(new Keyframe(1.00f,1.00f,0.00f,0.00f));
             break;
         case AMTween.EaseType.easeInElastic:
             _curve.AddKey(new Keyframe(0.00f,0.00f,0.00f,0.00f));
             _curve.AddKey(new Keyframe(0.15f,0.00f,-0.04f,-0.04f));
             _curve.AddKey(new Keyframe(0.30f,-0.005f,0.04f,0.04f));
             _curve.AddKey(new Keyframe(0.42f,0.02f,-0.07f,-0.07f));
             _curve.AddKey(new Keyframe(0.58f,-0.04f,0.15f,0.15f));
             _curve.AddKey(new Keyframe(0.72f,0.13f,0.20f,0.20f));
             _curve.AddKey(new Keyframe(0.80f,-0.13f,-5.33f,-5.33f));
             _curve.AddKey(new Keyframe(0.868f,-0.375f,0.14f,0.14f));
             _curve.AddKey(new Keyframe(0.92f,-0.05f,11.32f,11.32f));
             _curve.AddKey(new Keyframe(1.00f,1.00f,7.50f,7.50f));
             break;
         case AMTween.EaseType.easeOutElastic:
             _curve.AddKey(new Keyframe(0.000f,0.00f,6.56f,6.56f));
             _curve.AddKey(new Keyframe(0.079f,1.06f,11.22f,11.22f));
             _curve.AddKey(new Keyframe(0.134f,1.38f,0.03f,0.03f));
             _curve.AddKey(new Keyframe(0.204f,1.10f,-5.24f,-5.24f));
             _curve.AddKey(new Keyframe(0.289f,0.87f,0.65f,0.65f));
             _curve.AddKey(new Keyframe(0.424f,1.05f,0.13f,0.13f));
             _curve.AddKey(new Keyframe(0.589f,0.98f,0.12f,0.12f));
             _curve.AddKey(new Keyframe(0.696f,1.00f,0.07f,0.07f));
             _curve.AddKey(new Keyframe(0.898f,1.00f,0.00f,0.00f));
             _curve.AddKey(new Keyframe(1.000f,1.00f,0.00f,0.00f));
             break;
     case AMTween.EaseType.easeInOutElastic:
             _curve.AddKey(new Keyframe(0.000f,0.00f,0.00f,0.00f));
             _curve.AddKey(new Keyframe(0.093f,0.00f,-0.05f,-0.05f));
             _curve.AddKey(new Keyframe(0.149f,0.00f,0.06f,0.06f));
             _curve.AddKey(new Keyframe(0.210f,0.01f,-0.04f,-0.04f));
             _curve.AddKey(new Keyframe(0.295f,-0.02f,0.31f,0.31f));
             _curve.AddKey(new Keyframe(0.356f,0.07f,0.11f,0.11f));
             _curve.AddKey(new Keyframe(0.400f,-0.06f,-5.12f,-5.12f));
             _curve.AddKey(new Keyframe(0.435f,-0.19f,0.18f,0.18f));
             _curve.AddKey(new Keyframe(0.463f,0.02f,12.44f,12.44f));
             _curve.AddKey(new Keyframe(0.500f,0.50f,8.33f,8.33f));
             _curve.AddKey(new Keyframe(0.540f,1.03f,12.05f,12.05f));
             _curve.AddKey(new Keyframe(0.568f,1.18f,0.31f,0.31f));
             _curve.AddKey(new Keyframe(0.604f,1.04f,-5.03f,-5.03f));
             _curve.AddKey(new Keyframe(0.645f,0.93f,0.36f,0.36f));
             _curve.AddKey(new Keyframe(0.705f,1.02f,0.39f,0.39f));
             _curve.AddKey(new Keyframe(0.786f,0.99f,-0.04f,-0.04f));
             _curve.AddKey(new Keyframe(0.848f,1.00f,0.04f,0.04f));
             _curve.AddKey(new Keyframe(0.900f,1.00f,-0.01f,-0.01f));
             _curve.AddKey(new Keyframe(1.000f,1.00f,0.00f,0.00f));
         break;
     case AMTween.EaseType.spring:
             _curve.AddKey(new Keyframe(0.000f,0.00f,3.51f,3.51f));
             _curve.AddKey(new Keyframe(0.367f,0.88f,1.79f,1.79f));
             _curve.AddKey(new Keyframe(0.615f,1.08f,-0.28f,-0.28f));
             _curve.AddKey(new Keyframe(0.795f,0.97f,0.03f,0.03f));
             _curve.AddKey(new Keyframe(0.901f,1.01f,0.20f,0.20f));
             _curve.AddKey(new Keyframe(1.000f,1.00f,0.00f,0.00f));
         break;
     }
     return _curve;
 }