/** * @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); }
/** * @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); }
/** * @brief Removes a track * @param track Track to remove * @sa AddTrack */ public void Remove(FTrack track) { if (_tracks.Remove(track)) { track.SetTimeline(null); UpdateTrackIds(); } }
/// @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(); }
public void Remove(FTrack track) { if (_tracks.Remove(track)) { track.SetContainer(null); UpdateTrackIds(); } }
public void Add(FTrack track) { int id = _tracks.Count; _tracks.Add(track); track.SetContainer(this); track.SetId(id); }
/// @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); }
/// @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; } } }
// 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; } }
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); }
public void Add(FTrack track) { int id = _tracks.Count; _tracks.Add(track); track.SetTimeline(this); track.SetId(id); if (!Sequence.IsStopped) { track.Init(); } }
/** * @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(); }
/** * @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); }
public FAnimationTrackCache(FTrack track) : base(track) { }
public FTrackCache(FTrack track) { _track = track; }
public FParticleTrackCache(FTrack track) : base(track) { }