Files
tools/Unity C++脚本/NumberScrollPlayableAsset.cs
2025-08-01 10:50:57 +08:00

38 lines
922 B
C#

using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
using TMPro;
[System.Serializable]
public class NumberScrollPlayableAsset : PlayableAsset
{
public ExposedReference<TMP_Text> textMesh;
public int startValue;
public int endValue;
public ClipCaps clipCaps
{
get { return ClipCaps.None; }
}
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
{
var playable = ScriptPlayable<NumberScrollPlayableBehaviour>.Create(graph);
NumberScrollPlayableBehaviour behaviour = playable.GetBehaviour();
behaviour.textMesh = textMesh.Resolve(graph.GetResolver());
behaviour.startValue = startValue;
behaviour.endValue = endValue;
return playable;
}
}
[System.Serializable]
public class NumberScrollBehaviour : PlayableBehaviour
{
public float startValue;
public float endValue;
}