| using System; |
| using UnityEngine.Playables; |
|
|
| namespace UnityEngine.Timeline |
| { |
| |
| |
| |
| [Serializable] |
| [TrackClipType(typeof(ActivationPlayableAsset))] |
| [TrackBindingType(typeof(GameObject))] |
| [ExcludeFromPreset] |
| [TimelineHelpURL(typeof(ActivationTrack))] |
| public class ActivationTrack : TrackAsset |
| { |
| [SerializeField] |
| PostPlaybackState m_PostPlaybackState = PostPlaybackState.LeaveAsIs; |
| ActivationMixerPlayable m_ActivationMixer; |
|
|
| |
| |
| |
| public enum PostPlaybackState |
| { |
| |
| |
| |
| Active, |
|
|
| |
| |
| |
| Inactive, |
|
|
| |
| |
| |
| Revert, |
|
|
| |
| |
| |
| LeaveAsIs |
| } |
|
|
| internal override bool CanCompileClips() |
| { |
| return !hasClips || base.CanCompileClips(); |
| } |
|
|
| |
| |
| |
| public PostPlaybackState postPlaybackState |
| { |
| get { return m_PostPlaybackState; } |
| set { m_PostPlaybackState = value; UpdateTrackMode(); } |
| } |
|
|
| |
| public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) |
| { |
| var mixer = ActivationMixerPlayable.Create(graph, inputCount); |
| m_ActivationMixer = mixer.GetBehaviour(); |
|
|
| UpdateTrackMode(); |
|
|
| return mixer; |
| } |
|
|
| internal void UpdateTrackMode() |
| { |
| if (m_ActivationMixer != null) |
| m_ActivationMixer.postPlaybackState = m_PostPlaybackState; |
| } |
|
|
| |
| public override void GatherProperties(PlayableDirector director, IPropertyCollector driver) |
| { |
| var gameObject = GetGameObjectBinding(director); |
| if (gameObject != null) |
| { |
| driver.AddFromName(gameObject, "m_IsActive"); |
| } |
| } |
|
|
| |
| protected override void OnCreateClip(TimelineClip clip) |
| { |
| clip.displayName = "Active"; |
| base.OnCreateClip(clip); |
| } |
| } |
| } |
|
|