Ejemplo n.º 1
0
        /**
         * @brief Creates a FTrack.
         * @param T type of event this track will hold
         */
        public static FTrack Create <T>() where T : FEvent
        {
            Type evtType = typeof(T);

            string     evtName = evtType.Name;
            GameObject trackGO = new GameObject(evtName);

            Type trackType = typeof(FTrack);

#if NETFX_CORE
            System.Attribute[] customAttributes = new List <System.Attribute>(evtType.GetTypeInfo().GetCustomAttributes(typeof(FEventAttribute), false)).ToArray();
#else
            object[] customAttributes = evtType.GetCustomAttributes(typeof(FEventAttribute), false);
#endif
            if (customAttributes.Length > 0)
            {
                trackType = ((FEventAttribute)customAttributes[0]).trackType;
            }

            FTrack track = (FTrack)trackGO.AddComponent(trackType);

            track.SetEventType(evtType);
            track.CacheMode = track.RequiredCacheMode;
            track.SetOwner(trackGO.transform);

            return(track);
        }
Ejemplo n.º 2
0
        /**
         * @brief Creates a FTrack.
         * @param T type of event this track will hold
         */
        public static FTrack Create <T>() where T : FEvent
        {
            Type evtType = typeof(T);

            string     evtName = evtType.Name;
            GameObject trackGO = new GameObject(evtName);

            Type trackType = typeof(FTrack);

            object[] customAttributes = evtType.GetCustomAttributes(typeof(FEventAttribute), false);
            if (customAttributes.Length > 0)
            {
                trackType = ((FEventAttribute)customAttributes[0]).trackType;
            }

            FTrack track = (FTrack)trackGO.AddComponent(trackType);

            //track._evtType = evtType;
            //track._evtTypeStr = evtType.ToString();
            track.SetEventType(evtType);
            track.CacheMode = track.RequiredCacheMode;

//			track.CacheType = track.DefaultCacheType();
//			CEvent evt = CEvent.Create<T>( range );
//
//			track.Add( evt );
//
//			track._timeline = timeline;
//			track.SetId( id );

            return(track);
        }
Ejemplo n.º 3
0
        /**
         * @brief Removes a track
         * @param track Track to remove
         * @sa AddTrack
         */
        public void Remove(FTrack track)
        {
            if (_tracks.Remove(track))
            {
                track.SetTimeline(null);

                UpdateTrackIds();
            }
        }
Ejemplo n.º 4
0
        /// @brief Removes timeline with id.
        /// @oaram id Id of the CTimeline to remove.
        /// @note After calling this function, the ids of the timelines after this
        /// one in the list will have an id smaller by 1.
        /// @warning Does not check if id is valid (i.e. between -1 & GetTimelines().Count)
        public void Remove(int id)
        {
            FTrack track = _tracks[id];

            _tracks.RemoveAt(id);
            track.SetContainer(null);

            UpdateTrackIds();
        }
Ejemplo n.º 5
0
        public void Remove(FTrack track)
        {
            if (_tracks.Remove(track))
            {
                track.SetContainer(null);

                UpdateTrackIds();
            }
        }
Ejemplo n.º 6
0
        public void Add(FTrack track)
        {
            int id = _tracks.Count;

            _tracks.Add(track);

            track.SetContainer(this);
            track.SetId(id);
        }
Ejemplo n.º 7
0
        /// @brief Adds new timeline at the end of the list.
        /// @param timeline New timeline.
        public void Add(FTrack track)
        {
            int id = _tracks.Count;

            _tracks.Add(track);
            track.SetId(id);

            //			timeline.SetSequence( this );
            track.SetContainer(this);
        }
Ejemplo n.º 8
0
 /// @brief Removes timeline and updates their ids.
 /// @param timeline CTimeline to remove.
 /// @note After calling this function, the ids of the timelines after this
 /// one in the list will have an id smaller by 1.
 public void Remove(FTrack track)
 {
     for (int i = 0; i != _tracks.Count; ++i)
     {
         if (_tracks[i] == track)
         {
             Remove(i);
             break;
         }
     }
 }
Ejemplo n.º 9
0
 // sets the track this event belongs to, to be called only by FTrack
 internal void SetTrack(FTrack track)
 {
     _track = track;
     if (_track)
     {
         transform.parent = _track.transform;
     }
     else
     {
         transform.parent = null;
     }
 }
Ejemplo n.º 10
0
        public FTrack Add <T>(FrameRange range) where T : FEvent
        {
            FTrack track = FTrack.Create <T>();

            Add(track);

            FEvent evt = FEvent.Create <T>(range);

            track.Add(evt);

            return(track);
        }
Ejemplo n.º 11
0
        public void Add(FTrack track)
        {
            int id = _tracks.Count;

            _tracks.Add(track);

            track.SetTimeline(this);
            track.SetId(id);

            if (!Sequence.IsStopped)
            {
                track.Init();
            }
        }
Ejemplo n.º 12
0
        /**
         * @brief Rebuilds a timeline. To be called when the hierarchy changes,
         * ie tracks get added / deleted.
         */
        public void Rebuild()
        {
            Transform t = transform;

            _tracks.Clear();

            for (int i = 0; i != t.childCount; ++i)
            {
                FTrack track = t.GetChild(i).GetComponent <FTrack>();
                if (track)
                {
                    _tracks.Add(track);
                    track.SetTimeline(this);
                    track.Rebuild();
                }
            }

            UpdateTrackIds();
        }
Ejemplo n.º 13
0
        /**
         * @brief Adds a new track to the timeline
         * @param range A track by default is added with 1 event
         * @T Event type that the track will hold
         * @sa RemoveTrack
         */
        public FTrack Add <T>(FrameRange range) where T : FEvent
        {
            FTrack track = FTrack.Create <T>();

            Add(track);
//			int id = _tracks.Count;
//
//			_tracks.Add( track );
//
//			track.SetTimeline( this );
//			track.SetId( id );
//
//			if( !Sequence.IsStopped )
//				track.Init();

            FEvent evt = FEvent.Create <T>(range);

            track.Add(evt);

            return(track);
        }
Ejemplo n.º 14
0
 public FAnimationTrackCache(FTrack track)
     : base(track)
 {
 }
Ejemplo n.º 15
0
 public FTrackCache(FTrack track)
 {
     _track = track;
 }
Ejemplo n.º 16
0
 public FParticleTrackCache(FTrack track)
     : base(track)
 {
 }