33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Timeline;
|
|
using UnityEngine.Playables;
|
|
|
|
namespace Thousandto.Launcher.ExternalLibs
|
|
{
|
|
[TrackColor(0.155f, 0.8623f, 0.870f)]
|
|
[TrackClipType(typeof(ScriptActivationClip))]
|
|
[TrackBindingType(typeof(GameObject))]
|
|
public class ScriptActivationTrack : TrackAsset
|
|
{
|
|
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
|
{
|
|
var playable = ScriptPlayable<ScriptActivationMixBehaviour>.Create(graph, inputCount);
|
|
var bh = playable.GetBehaviour();
|
|
bh.Clips = new TimelineClip[inputCount];
|
|
var index = 0;
|
|
var enumerator = GetClips().GetEnumerator();
|
|
while (enumerator.MoveNext())
|
|
{
|
|
var tc = enumerator.Current;
|
|
var clip = tc.asset as ScriptActivationClip;
|
|
bh.Clips[index] = enumerator.Current;
|
|
// 重命名
|
|
tc.displayName = clip.BehaviourName;
|
|
index++;
|
|
}
|
|
return playable;
|
|
}
|
|
|
|
}
|
|
}
|