diff --git a/Assets/Fungus/Scripts/Commands/Conversation.cs b/Assets/Fungus/Scripts/Commands/Conversation.cs index c7dfb143..42e1da4a 100644 --- a/Assets/Fungus/Scripts/Commands/Conversation.cs +++ b/Assets/Fungus/Scripts/Commands/Conversation.cs @@ -7,11 +7,11 @@ using System.Collections; namespace Fungus { /// - /// Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text]. + /// Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [hide] [<<< | >>>] [clear | noclear] [wait | nowait] [fade | nofade] [: Story text]. /// [CommandInfo("Narrative", - "Conversation", - "Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text]")] + "Conversation", + "Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [hide] [<<< | >>>] [clear | noclear] [wait | nowait] [fade | nofade] [: Story text]")] [AddComponentMenu("")] [ExecuteInEditMode] public class Conversation : Command @@ -20,6 +20,12 @@ namespace Fungus protected ConversationManager conversationManager = new ConversationManager(); + [SerializeField] protected BooleanData clearPrevious = new BooleanData(true); + [SerializeField] protected BooleanData waitForInput = new BooleanData(true); + [Tooltip("a wait for seconds added to each item of the conversation.")] + [SerializeField] protected FloatData waitForSeconds = new FloatData(0); + [SerializeField] protected BooleanData fadeWhenDone = new BooleanData(true); + protected virtual void Start() { conversationManager.PopulateCharacterCache(); @@ -30,6 +36,11 @@ namespace Fungus var flowchart = GetFlowchart(); string subbedText = flowchart.SubstituteVariables(conversationText.Value); + conversationManager.ClearPrev = clearPrevious; + conversationManager.WaitForInput = waitForInput; + conversationManager.FadeDone = fadeWhenDone; + conversationManager.WaitForSeconds = waitForSeconds; + yield return StartCoroutine(conversationManager.DoConversation(subbedText)); Continue(); diff --git a/Assets/Fungus/Scripts/Utils/ConversationManager.cs b/Assets/Fungus/Scripts/Utils/ConversationManager.cs index 04d5209e..5ca20b51 100644 --- a/Assets/Fungus/Scripts/Utils/ConversationManager.cs +++ b/Assets/Fungus/Scripts/Utils/ConversationManager.cs @@ -34,6 +34,7 @@ namespace Fungus public bool ClearPrev { get; set; } public bool WaitForInput { get; set; } public bool FadeDone { get; set; } + public FloatData WaitForSeconds { get; internal set; } public ConversationManager() { @@ -167,6 +168,11 @@ namespace Fungus // Populate the story text to be written item.Text = text; + if(WaitForSeconds > 0) + { + item.Text += "{w=" + WaitForSeconds.ToString() +"}"; + } + if (sayParams == null || sayParams.Length == 0) { // Text only, no params - early out.