diff --git a/Assets/Fungus/Dialog/Editor/SayEditor.cs b/Assets/Fungus/Dialog/Editor/SayEditor.cs index c765f0a2..4045d5d9 100644 --- a/Assets/Fungus/Dialog/Editor/SayEditor.cs +++ b/Assets/Fungus/Dialog/Editor/SayEditor.cs @@ -36,7 +36,8 @@ namespace Fungus protected SerializedProperty characterProp; protected SerializedProperty sayDialogProp; protected SerializedProperty voiceOverClipProp; - protected SerializedProperty showOnceProp; + protected SerializedProperty showAlwaysProp; + protected SerializedProperty showCountProp; protected virtual void OnEnable() { @@ -44,7 +45,8 @@ namespace Fungus characterProp = serializedObject.FindProperty("character"); sayDialogProp = serializedObject.FindProperty("sayDialog"); voiceOverClipProp = serializedObject.FindProperty("voiceOverClip"); - showOnceProp = serializedObject.FindProperty("showOnce"); + showAlwaysProp = serializedObject.FindProperty("showAlways"); + showCountProp = serializedObject.FindProperty("showCount"); } public override void DrawCommandGUI() @@ -97,10 +99,14 @@ namespace Fungus new GUIContent(""), SayDialog.activeDialogs); - EditorGUILayout.PropertyField(voiceOverClipProp, - new GUIContent("Voice Over Clip", "Voice over audio to play when the say text is displayed")); + EditorGUILayout.PropertyField(voiceOverClipProp); - EditorGUILayout.PropertyField(showOnceProp, new GUIContent("Show Once", "Show this text once and never show it again.")); + EditorGUILayout.PropertyField(showAlwaysProp); + + if (showAlwaysProp.boolValue == false) + { + EditorGUILayout.PropertyField(showCountProp); + } serializedObject.ApplyModifiedProperties(); } diff --git a/Assets/Fungus/Dialog/Scripts/Commands/Say.cs b/Assets/Fungus/Dialog/Scripts/Commands/Say.cs index 25e00ff6..79e39f47 100644 --- a/Assets/Fungus/Dialog/Scripts/Commands/Say.cs +++ b/Assets/Fungus/Dialog/Scripts/Commands/Say.cs @@ -25,8 +25,11 @@ namespace Fungus [Tooltip("Voiceover audio to play when writing the story text")] public AudioClip voiceOverClip; - [Tooltip("Only show this text once, even if the command is executed again")] - public bool showOnce; + [Tooltip("Always show this Say text when the command is executed multiple times")] + public bool showAlways = true; + + [Tooltip("Number of times to show this Say text when the command is executed multiple times")] + public int showCount = 1; protected int executionCount; @@ -34,7 +37,7 @@ namespace Fungus public override void OnEnter() { - if (showOnce && executionCount > 0) + if (!showAlways && executionCount >= showCount) { Continue(); return;