public static Tweener MoveTo(this Transform t, Vector3 position, float duration, Func <float, float, float, float> equation)
    {
        TransformPositionTweener tweener = t.gameObject.AddComponent <TransformPositionTweener>();

        tweener.startValue             = t.position;
        tweener.endValue               = position;
        tweener.easingControl.duration = duration;
        tweener.easingControl.equation = equation;
        tweener.easingControl.Play();
        return(tweener);
    }
Пример #2
0
    public static Tweener MoveToUsingCurve(this Transform t, Vector3 position, float duration, AnimationCurve curve)
    {
        TransformPositionTweener tweener = t.gameObject.AddComponent <TransformPositionTweener>();

        tweener.StartTweenValue   = t.position;
        tweener.EndTweenValue     = position;
        tweener.duration          = duration;
        tweener.curve             = curve;
        tweener.useAnimationCurve = true;
        tweener.Play();
        return(tweener);
    }