added use unce to dialogue trigger and trigger editor

This commit is contained in:
2025-02-11 17:02:03 +01:00
parent c7bac778a7
commit 613008e7f2
2 changed files with 7 additions and 2 deletions

View File

@@ -165,6 +165,8 @@ namespace PixelCrushers.DialogueSystem
questPicker.showReferenceDatabase = false;
}
if (newDatabase != null) EditorTools.selectedDatabase = newDatabase;
var fireOnceProperty = serializedObject.FindProperty("fireOnce");
EditorGUILayout.PropertyField(fireOnceProperty);
}
protected virtual void DrawConditions()

View File

@@ -29,7 +29,7 @@ namespace PixelCrushers.DialogueSystem
[Tooltip("The trigger that this component listens for.")]
[DialogueSystemTriggerEvent]
public DialogueSystemTriggerEvent trigger = DialogueSystemTriggerEvent.OnUse;
public bool fireOnce = true;
/// <summary>
/// The conditions under which the trigger will fire.
/// </summary>
@@ -363,7 +363,7 @@ namespace PixelCrushers.DialogueSystem
protected bool didIPause = false;
protected float preConversationTimeScale = 1;
protected bool tryingToStart = false;
protected bool hasFired = false;
#endregion
#region Trigger Checks
@@ -609,6 +609,8 @@ namespace PixelCrushers.DialogueSystem
public void TryStart(Transform actor, Transform interactor)
{
if (tryingToStart) return;
if (fireOnce && hasFired)
return;
tryingToStart = true;
try
{
@@ -626,6 +628,7 @@ namespace PixelCrushers.DialogueSystem
public void Fire(Transform actor)
{
if (DialogueDebug.logInfo) Debug.Log("Dialogue System: Dialogue System Trigger is firing " + trigger + ".", this);
hasFired = true;
DoQuestAction();
DoLuaAction();
DoSequenceAction(actor);