Browse Source

Run Slow In Editor option

master
chrisgregan 10 years ago
parent
commit
c98412bac1
  1. 13
      Assets/Fungus/FungusScript/Scripts/FungusScript.cs
  2. 4
      Assets/Fungus/FungusScript/Scripts/Sequence.cs

13
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.

4
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));
}
}

Loading…
Cancel
Save