编写自定义操作(C#)
创建自定义动作的不同方式
将动作作为组件创建
[System.Serializable]
class ExampleActionComponent : TypewriterActionScriptable
{
[SerializeField] float timeToWait;
// 主逻辑在这里,
// ...可以是无状态的
protected override IActionState CreateCustomState(ActionMarker marker, object typewriter)
=> new ExampleState(timeToWait);
// ...或作为协程
protected override IEnumerator PerformAction(TypingInfo typingInfo)
{
// yield return ...
}
}