38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
using UnityEngine.Timeline;
|
|
|
|
namespace FT.Timeline
|
|
{
|
|
|
|
[Serializable]
|
|
#if UNITY_EDITOR
|
|
[System.ComponentModel.DisplayName("Sibling Order Clip")]
|
|
#endif
|
|
public class SiblingOrderPlayableAsset : PlayableAsset, ITimelineClipAsset
|
|
{
|
|
[Header("子物体列表 列表顺序即播放timeline之后在父物体内部的顺序")]
|
|
[SerializeField]
|
|
public List<ExposedReference<GameObject>> children = new List<ExposedReference<GameObject>>();
|
|
|
|
public ClipCaps clipCaps => ClipCaps.None;
|
|
|
|
public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
|
|
{
|
|
var playable = ScriptPlayable<SiblingOrderBehaviour>.Create(graph);
|
|
var behaviour = playable.GetBehaviour();
|
|
|
|
behaviour.children = new List<GameObject>();
|
|
var resolver = graph.GetResolver();
|
|
foreach (var child in children)
|
|
{
|
|
behaviour.children.Add(child.Resolve(resolver));
|
|
}
|
|
|
|
return playable;
|
|
}
|
|
}
|
|
}
|