40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using UnityEngine;
|
||
|
||
namespace CustomComponent
|
||
{
|
||
public abstract class StoryDirectiveAsset : ScriptableObject
|
||
{
|
||
[SerializeField] private bool _enabled = true;
|
||
|
||
[SerializeField] private StoryTriggerType _triggerType = StoryTriggerType.DialogCompleted;
|
||
|
||
[SerializeField] [Tooltip("DialogCompleted 时为对话 Id;<=0 表示该触发类型下的任意 Id。")]
|
||
private int _triggerId = 0;
|
||
|
||
public bool IsEnabled => _enabled;
|
||
|
||
public StoryTriggerType TriggerType => _triggerType;
|
||
|
||
public int TriggerId => _triggerId;
|
||
|
||
public virtual string ActionName => GetType().Name;
|
||
|
||
public bool IsMatch(StoryTriggerType triggerType, int triggerId)
|
||
{
|
||
if (!_enabled || _triggerType != triggerType)
|
||
{
|
||
return false;
|
||
}
|
||
|
||
if (triggerType == StoryTriggerType.DialogCompleted && _triggerId > 0 && _triggerId != triggerId)
|
||
{
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
public abstract void Execute(StoryDirectorComponent director);
|
||
}
|
||
}
|