diff --git a/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Inspectors/Triggers/DialogueSystemTriggerEditor.cs b/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Inspectors/Triggers/DialogueSystemTriggerEditor.cs index 29c03c9ef..13c70c3f0 100644 --- a/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Inspectors/Triggers/DialogueSystemTriggerEditor.cs +++ b/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Inspectors/Triggers/DialogueSystemTriggerEditor.cs @@ -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() diff --git a/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs b/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs index 6ce44d34e..7fb18736b 100644 --- a/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs +++ b/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs @@ -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; /// /// The conditions under which the trigger will fire. /// @@ -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);