예제 #1
0
        public static ZTweener DOFade(GameObject go, bool reset)
        {
            ZTweener ret = null;

            if (go)
            {
                var list = ListPool <Component> .Get();

                go.GetComponents(typeof(FadeBase), list);
                float duration = 0;
                for (int i = 0; i < list.Count; ++i)
                {
                    var com = list[i];
                    var fad = com as FadeBase;
                    if (fad.DOFade(reset))
                    {
                        if (fad.loops < 0)
                        {
                            continue;
                        }
                        int nLoop      = fad.loops == 0 ? 1 : fad.loops;
                        var fxDuration = fad.duration * nLoop + fad.delay;
                        if (duration < fxDuration)
                        {
                            duration = fxDuration;
                            ret      = fad.tweener;
                        }
                    }
                }
                ListPool <Component> .Release(list);
            }
            return(ret);
        }
예제 #2
0
    void Start()
    {
        ZTweener ZTweener = transform.MoveTo(new Vector3(5, 0, 0), 3f, EasingEquations.EaseInOutQuad);

        ZTweener.easingControl.loopCount = -1;
        ZTweener.easingControl.loopType  = EasingControl.LoopType.PingPong;
    }
예제 #3
0
        public ZTweener Tween(object from, object to, float duration)
        {
            ZTweener tw = null;

            if (to is Color)
            {
                tw = this.TweenColor((Color)to, duration);
                if (from is Color)
                {
                    color = (Color)from;
                    tw.StartFrom(color);
                }
            }
            else if (to is float)
            {
                tw = this.TweenFill((float)to, duration);
                if (from is float)
                {
                    fillAmount = (float)from;
                    tw.StartFrom(fillAmount);
                }
            }
            if (tw != null)
            {
                tw.SetTag(this);
            }
            return(tw);
        }
예제 #4
0
        public ZTweener Tween(object from, object to, float duration)
        {
            ZTweener tw = null;

            if (to is float)
            {
                tw = ZTween.Tween(Getter, Setter, (float)to, duration);
                if (from != null)
                {
                    value = (float)from;
                    tw.StartFrom(value);
                }
            }

            if (tw != null)
            {
                tw.SetTag(this);
            }
            return(tw);
        }
예제 #5
0
        public ZTweener Tween(object from, object to, float duration)
        {
            ZTweener tw = null;

            if (to is Color)
            {
                tw = ZTween.Tween(ColorGetter, ColorSetter, (Color)to, 0f);
                if (from is Color)
                {
                    color = (Color)from;
                    tw.StartFrom(color);
                }
            }

            if (tw != null)
            {
                tw.SetTag(this);
            }
            return(tw);
        }
예제 #6
0
        public ZTweener Tween(object from, object to, float duration)
        {
            ZTweener tw = null;

            if (to is Color)
            {
                tw = this.TweenColor((Color)to, duration);
                if (from is Color)
                {
                    tw.StartFrom((Color)from);
                }
            }
            else if (to is float)
            {
                tw = this.TweenAlpha((float)to, duration);
                if (from is float)
                {
                    var fromColor = color;
                    fromColor.a = (float)from;
                    color       = fromColor;
                    tw.StartFrom(color);
                }
            }
            else if (to is Vector2)
            {
                tw = ZTween.Tween(GetUVOffset, SetUVOffset, (Vector2)to, duration);
                if (from is Vector2)
                {
                    tw.StartFrom((Vector2)from);
                }
            }
            else if (to is Vector4)
            {
            }
            if (tw != null)
            {
                tw.SetTag(this);
            }
            return(tw);
        }
예제 #7
0
        public ZTweener Tween(object from, object to, float duration)
        {
            ZTweener tw = null;

            if (to is string)
            {
                tw = this.TweenString((string)to, duration);
                if (from != null)
                {
                    text = (string)from;
                    tw.StartFrom(text);
                }
            }
            if (to is Color)
            {
                tw = this.TweenColor((Color)to, duration);
                if (from is Color)
                {
                    color = (Color)from;
                    tw.StartFrom(color);
                }
            }
            if (to is float)
            {
                tw = this.TweenAlpha((float)to, duration);
                if (from is float)
                {
                    var a = (float)from;
                    color = new Color(color.r, color.g, color.b, a);
                    tw.StartFrom(a);
                }
            }
            if (tw != null)
            {
                tw.SetTag(this);
            }
            return(tw);
        }
예제 #8
0
        public bool DOFade(bool reset, bool forward = true)
        {
            OnDisable();
            m_Tweener = AnimateFade(forward);

            if (m_Tweener != null)
            {
                m_Tweener.SetTag(gameObject).SetUpdate(UpdateType.Normal, m_IgnoreTimescale);
                if (loops != 0)
                {
                    m_Tweener.LoopFor(loops, loopType);
                }
                if (reset)
                {
                    if (delay == 0)
                    {
                        this.Restart();
                        m_Tweener.StartFrom(forward ? source : destina);
                    }
                }
            }
            return(m_Tweener != null);
        }