Esempio n. 1
0
        void PrepareTween(object obj,
                          FieldInfo fieldInfo,
                          float tweenFrom,
                          float tweenTo,
                          float duration,
                          EasingFunc easing,
                          TweenDelegate callback)
        {
            int idx = FindTween(obj, fieldInfo.Name);

            if (idx < 0)
            {
                idx = m_Tweens.Count;
                m_Tweens.Add(new Tween());
            }

            Tween tween = m_Tweens[idx];

            tween.Object    = obj;
            tween.FieldName = fieldInfo.Name;
            tween.FieldInfo = fieldInfo;
            if (tween.TweenFrom != tweenFrom || tween.TweenTo != tweenTo)
            {
                tween.TweenFrom = tweenFrom;
                tween.TweenTo   = tweenTo;
                tween.StartTime = Time.time;
            }
            tween.Duration = duration;
            tween.Easing   = easing ?? Easing.Linear.EaseNone;
            tween.Callback = callback;
            m_Tweens[idx]  = tween;
        }
Esempio n. 2
0
 public Transition(float From, float To, float Duration, Tween.EasingFunc Easing)
 {
     m_From      = From;
     m_To        = To;
     m_BeginTime = Time.time;
     m_Duration  = Duration;
     m_Easing    = Easing ?? Tween.Easing.Linear.EaseNone;
 }
Esempio n. 3
0
        public bool TweenFrom(object obj,
                              string fieldName,
                              float tweenFrom,
                              float duration,
                              EasingFunc easing      = null,
                              TweenDelegate callback = null)
        {
            if (obj == null)
            {
                return(false);
            }

            FieldInfo fieldInfo = GetField(obj, fieldName);

            if (fieldInfo == null)
            {
                return(false);
            }

            PrepareTween(obj, fieldInfo, tweenFrom, (float)fieldInfo.GetValue(obj), duration, easing, callback);

            return(true);
        }