Exemplo n.º 1
0
        /*
         * =====
         * Private Methods
         * =====
         */

        /**
         *  Creates an NDTweenWorker component on the target game object
         */
        static private NDTweenWorker CreateTweenWorker(bool isTo, GameObject target, Vector3 position, Vector3 scale, Vector3 rotation, Color color, string colorTarget, float timeInSeconds, Func <float, float> easing = null, float delay = 0f, bool destroyOnComplete = true, bool clearCurrentTweens = false, bool autoPlay = true, bool isUI = false, bool isGlobal = false)
        {
            //remove any previous tweens if needed
            if (clearCurrentTweens)
            {
                NDTween.RemoveAllTweens(target);
            }

            //create the component and add to the target game object
            NDTweenWorker tweenWorker = target.AddComponent <NDTweenWorker>();

            tweenWorker.targetGameObject = target;

            //set tween properties
            tweenWorker.startPosition = isTo ? isGlobal ? target.transform.position : target.transform.localPosition : position;
            tweenWorker.endPosition   = isTo ? position : isGlobal ? target.transform.position : target.transform.localPosition;

            tweenWorker.startScale = isTo ? target.transform.localScale : scale;
            tweenWorker.endScale   = isTo ? scale : target.transform.localScale;

            tweenWorker.startRotation = isTo ? target.transform.localRotation.eulerAngles : rotation;
            tweenWorker.endRotation   = isTo ? rotation : target.transform.localRotation.eulerAngles;

            tweenWorker.startColor = isTo ? NDTween.GetMaterialColor(target, colorTarget) : color;
            tweenWorker.endColor   = isTo ? color : NDTween.GetMaterialColor(target, colorTarget);

            tweenWorker.colorTarget = colorTarget;

            tweenWorker.tweenTimeInSeconds = timeInSeconds;
            tweenWorker.delay = delay;

            tweenWorker.isTo = isTo;

            tweenWorker.isUI = isUI;

            tweenWorker.easingEquation = NDTween.GetEasingEquation(easing);

            tweenWorker.destroyOnComplete = destroyOnComplete;

            //start it
            if (autoPlay)
            {
                tweenWorker.StartTween();
            }

            //return reference
            return(tweenWorker);
        }
Exemplo n.º 2
0
 public void AddTo(GameObject target, float timeInSeconds, Vector3 position, Vector3 scale, Func <float, float> easing = null, float delay = 0f, bool isUI = false)
 {
     AddTo(target, timeInSeconds, position, scale, target.transform.localRotation.eulerAngles, NDTween.GetMaterialColor(target, "_Color"), "_Color", easing, delay, isUI);
 }
Exemplo n.º 3
0
 public void AddFrom(GameObject target, float timeInSeconds, Vector3 position, Vector3 scale, Vector3 rotation, Color color, Func <float, float> easing = null, float delay = 0f, bool isUI = false)
 {
     AddFrom(target, timeInSeconds, position, scale, rotation, NDTween.GetMaterialColor(target, "_Color"), "_Color", easing, delay, isUI);
 }
Exemplo n.º 4
0
 static public NDTweenWorker RotateTo(GameObject target, float timeInSeconds, Vector3 rotation, NDTweenOptions options)
 {
     return(NDTween.To(target, timeInSeconds, target.transform.localPosition, target.transform.localScale, rotation, NDTween.GetMaterialColor(target, "_Color"), "_Color", options.easing, options.delay, options.destroyOnComplete, options.clearCurrentTweens, options.autoPlay, options.isUI));
 }
Exemplo n.º 5
0
 static public NDTweenWorker RotateTo(GameObject target, float timeInSeconds, Vector3 rotation, Func <float, float> easing = null, float delay = 0f, bool destroyOnComplete = true, bool clearCurrentTweens = true, bool autoPlay = true, bool isUI = false)
 {
     return(NDTween.To(target, timeInSeconds, target.transform.localPosition, target.transform.localScale, rotation, NDTween.GetMaterialColor(target, "_Color"), "_Color", easing, delay, destroyOnComplete, clearCurrentTweens, autoPlay, isUI));
 }
Exemplo n.º 6
0
 static public NDTweenWorker From(GameObject target, float timeInSeconds, Vector3 position, Vector3 scale, Vector3 rotation, NDTweenOptions options)
 {
     return(NDTween.From(target, timeInSeconds, position, scale, rotation, NDTween.GetMaterialColor(target, "_Color"), "_Color", options.easing, options.delay, options.destroyOnComplete, options.clearCurrentTweens, options.autoPlay, options.isUI));
 }
Exemplo n.º 7
0
 static public NDTweenWorker From(GameObject target, float timeInSeconds, Vector3 position, Vector3 scale, Func <float, float> easing = null, float delay = 0f, bool destroyOnComplete = true, bool clearCurrentTweens = true, bool autoPlay = true, bool isUI = false)
 {
     return(NDTween.From(target, timeInSeconds, position, scale, target.transform.localRotation.eulerAngles, NDTween.GetMaterialColor(target, "_Color"), "_Color", easing, delay, destroyOnComplete, clearCurrentTweens, autoPlay, isUI));
 }