From c98412bac1d33c7a1fbc90fef4f8b1a5e2851971 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 18 Sep 2014 11:28:41 +0100 Subject: [PATCH] Run Slow In Editor option --- Assets/Fungus/FungusScript/Scripts/FungusScript.cs | 13 +++++++++---- Assets/Fungus/FungusScript/Scripts/Sequence.cs | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Assets/Fungus/FungusScript/Scripts/FungusScript.cs b/Assets/Fungus/FungusScript/Scripts/FungusScript.cs index ef1f998d..80ab2a3c 100644 --- a/Assets/Fungus/FungusScript/Scripts/FungusScript.cs +++ b/Assets/Fungus/FungusScript/Scripts/FungusScript.cs @@ -77,12 +77,17 @@ namespace Fungus public class Settings { /** - * Minimum time for each command to execute when playing the scene in the editor. - * Slowing down the program flow makes it easier to visualise execution order. + * Slow down execution when playing in the editor to make it easier to visualise program flow. + */ + [Tooltip("Slow down execution in the editor to make it easier to visualise program flow")] + public bool runSlowInEditor = true; + + /** + * Minimum time for each command to execute when runSlowInEditor is enabled. */ [Range(0f, 5f)] - [Tooltip("Minimum time for each command to execute when playing the scene in the editor")] - public float minCommandDuration = 0.25f; + [Tooltip("Minimum time that each command will take to execute when Run Slow In Editor is enabled")] + public float runSlowDuration = 0.25f; /** * Use command color when displaying the command list in the Fungus Editor window. diff --git a/Assets/Fungus/FungusScript/Scripts/Sequence.cs b/Assets/Fungus/FungusScript/Scripts/Sequence.cs index b40ce9d4..3694e732 100644 --- a/Assets/Fungus/FungusScript/Scripts/Sequence.cs +++ b/Assets/Fungus/FungusScript/Scripts/Sequence.cs @@ -94,14 +94,14 @@ namespace Fungus { FungusScript fungusScript = GetFungusScript(); - if (fungusScript.settings.minCommandDuration == 0f) + if (!fungusScript.settings.runSlowInEditor) { activeCommand = nextCommand; nextCommand.Execute(); } else { - StartCoroutine(ExecuteAfterDelay(nextCommand, fungusScript.settings.minCommandDuration)); + StartCoroutine(ExecuteAfterDelay(nextCommand, fungusScript.settings.runSlowDuration)); } }