BITFALL/Assets/BITKit/UnityPluginsSupport/NodeCanvas/Timeline/DialogueClip.cs

24 lines
652 B
C#
Raw Normal View History

2023-08-27 02:58:19 +08:00
using System.Collections;
using System.Collections.Generic;
using NodeCanvas.DialogueTrees;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace BITKit.Timeline
{
public class DialogueClip : PlayableAsset
{
[SerializeField] private string subtitle;
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
{
var playable = ScriptPlayable<DialogueBehaviour>.Create(graph);
var behaviour = playable.GetBehaviour();
behaviour.duration = playable.GetDuration();
behaviour.subtitle = subtitle;
behaviour.actor = owner.GetComponent<DialogueActor>();
return playable;
}
}
}