Пример #1
0
        public RTTrackViz(RedTween.Track track, GameObject parent, int count, float setLength)
        {
            Track      = track;
            Panel      = new GameObject("Track", typeof(RectTransform));
            mTrackSize = (Track.Length / setLength) * mMaxTrackSize;
            RedTweenVisualizer.SetRect(Panel, parent, 2, -12 * count - 12, mTrackSize, 10, 0, 1, 0, 1);
            RedTweenVisualizer.SetImage(Panel, Color.white, 0.25f);

            float lastPercent = 0;

            for (int i = 0; i < Track.Clips.Count; i++)
            {
                RTClipViz clip = new RTClipViz(Track.Clips[i], Panel, Track.Length, lastPercent);
                Clips.Add(clip);
                lastPercent = clip.EndPercent;
            }

            GameObject markerObj = new GameObject("Track", typeof(RectTransform));

            RedTweenVisualizer.SetRect(markerObj, Panel, 0, 0, 1, 12, 0, 0.5f, 0, 0.5f);
            RedTweenVisualizer.SetImage(markerObj, Color.white, 1f);
            Marker = markerObj.GetComponent <RectTransform>();

            AddText();
        }
Пример #2
0
        // Wait Tween Clip will not do anything for a given period of time.
        // It can be used as a spacer in a Track. Or just to wait some amount of time before running an action.

        public WaitTweenClip(RedTween.Track track, float time, System.Action end)
        {
            mTrack       = track;
            mType        = RedTweenType.Wait;
            mEndAction   = end;
            mTime        = time;
            mInitialized = true;
        }
Пример #3
0
 public UIMoveToTweenClip(RedTween.Track track, RectTransform rect, Vector3 target, float time, EaseType ease, System.Action end)
 {
     mType      = RedTweenType.MoveBy;
     mRect      = rect;
     mTarget    = target;
     mTime      = time;
     mEndAction = end;
     mFunction  = Easing.EaseFunction(ease);
     mTrack     = track;
     if (mFunction != null)
     {
         mInitialized = true;
     }
 }
Пример #4
0
 public FunctionClip(RedTween.Track track, TweenFunction function, float time, EaseType ease, System.Action end)
 {
     if (function == null)
     {
         return;
     }
     mTrack         = track;
     mTime          = time;
     mFunctionTween = function;
     mEndAction     = end;
     mType          = RedTweenType.Function;
     mFunction      = Easing.EaseFunction(ease);
     if (mFunction != null)
     {
         mInitialized = true;
     }
 }
Пример #5
0
 public RotateToTweenClip(RedTween.Track track, GameObject obj, Vector3 angle, float time, EaseType ease, System.Action end)
 {
     if (obj == null)
     {
         return;
     }
     mTrans       = obj.transform;
     mTrack       = track;
     mTargetAngle = angle;
     mTime        = time;
     mType        = RedTweenType.RotateTo;
     mFunction    = Easing.EaseFunction(ease);
     if (mFunction != null)
     {
         mInitialized = true;
     }
 }
Пример #6
0
            public Track Track(int index, bool createIfNotFound = true)
            {
                // This will return the track at the specified index.
                // If the index is not found and create is true, a new track will be created and returned.
                // If create is false this function can be used to check if a track exists.
                if (mTracks.ContainsKey(index))
                {
                    return(mTracks[index]);
                }

                if (createIfNotFound)
                {
                    RedTween.Track t = new RedTween.Track(this, index);
                    mTracks.Add(index, t);
                    return(t);
                }

                return(null);
            }
Пример #7
0
        public MoveToTweenClip(RedTween.Track track, GameObject obj, Vector3 target, float time, EaseType ease, System.Action end, bool local)
        {
            if (obj == null)
            {
                // Object is null there is nothing to move.
                return;
            }

            mTrack     = track;
            mType      = (local)? RedTweenType.LocalMoveTo : RedTweenType.MoveTo;
            mTrans     = obj.transform;
            mTarget    = target;
            mTime      = time;
            mEndAction = end;
            mFunction  = Easing.EaseFunction(ease);
            mLocal     = local;
            if (mFunction != null)
            {
                mInitialized = true;
            }
        }
Пример #8
0
        public MoveByTweenClip(RedTween.Track track, GameObject obj, Vector3 amount, float time, EaseType ease, System.Action end, MoveByTweenClip previousClip, bool moveToMod, bool local)
        {
            if (obj == null)
            {
                // Object is null there is nothing to move.
                return;
            }

            mType           = (local)? RedTweenType.LocalMoveBy : ((previousClip == null)? RedTweenType.MoveBy : RedTweenType.MoveToModifier);
            mLocal          = local;
            mTrans          = obj.transform;
            mAmount         = amount;
            mTime           = time;
            mEndAction      = end;
            mFunction       = Easing.EaseFunction(ease);
            mPreviousClip   = previousClip;
            mMoveToModefier = moveToMod;
            mTrack          = track;
            if (mFunction != null)
            {
                mInitialized = true;
            }
        }