Browse Source

Moved Run Slow in Editor option to Sequence

Comments are skipped over immediately (no waiting)
master
chrisgregan 10 years ago
parent
commit
e249049858
  1. 9
      Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs
  2. 3
      Assets/Fungus/FungusScript/Editor/SequenceEditor.cs
  3. 6
      Assets/Fungus/FungusScript/Scripts/FungusScript.cs
  4. 10
      Assets/Fungus/FungusScript/Scripts/Sequence.cs

9
Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs

@ -10,18 +10,16 @@ namespace Fungus
[CustomEditor (typeof(FungusScript))]
public class FungusScriptEditor : Editor
{
protected SerializedProperty runSlowInEditorProp;
protected SerializedProperty runSlowDurationProp;
protected SerializedProperty colorCommandsProp;
protected SerializedProperty hideComponentsProp;
protected SerializedProperty runSlowDurationProp;
protected SerializedProperty variablesProp;
protected virtual void OnEnable()
{
runSlowInEditorProp = serializedObject.FindProperty("runSlowInEditor");
runSlowDurationProp = serializedObject.FindProperty("runSlowDuration");
colorCommandsProp = serializedObject.FindProperty("colorCommands");
hideComponentsProp = serializedObject.FindProperty("hideComponents");
runSlowDurationProp = serializedObject.FindProperty("runSlowDuration");
variablesProp = serializedObject.FindProperty("variables");
}
@ -33,10 +31,9 @@ namespace Fungus
fungusScript.UpdateHideFlags();
EditorGUILayout.PropertyField(runSlowInEditorProp);
EditorGUILayout.PropertyField(runSlowDurationProp);
EditorGUILayout.PropertyField(colorCommandsProp);
EditorGUILayout.PropertyField(hideComponentsProp);
EditorGUILayout.PropertyField(runSlowDurationProp);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();

3
Assets/Fungus/FungusScript/Editor/SequenceEditor.cs

@ -31,6 +31,9 @@ namespace Fungus
Sequence sequence = target as Sequence;
SerializedProperty runSlowInEditorProp = serializedObject.FindProperty("runSlowInEditor");
EditorGUILayout.PropertyField(runSlowInEditorProp);
DrawEventHandlerGUI(fungusScript);
UpdateIndentLevels(sequence);

6
Assets/Fungus/FungusScript/Scripts/FungusScript.cs

@ -59,12 +59,6 @@ namespace Fungus
[HideInInspector]
public List<Variable> variables = new List<Variable>();
/**
* 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.
*/

10
Assets/Fungus/FungusScript/Scripts/Sequence.cs

@ -12,6 +12,9 @@ namespace Fungus
{
public string sequenceName = "New Sequence";
[Tooltip("Slow down execution in the editor to make it easier to visualise program flow")]
public bool runSlowInEditor = true;
public EventHandler eventHandler;
[HideInInspector]
@ -96,7 +99,7 @@ namespace Fungus
}
else if (executeNext)
{
if (command.enabled)
if (command.enabled && command.GetType() != typeof(Comment))
{
nextCommand = command;
break;
@ -112,7 +115,9 @@ namespace Fungus
{
FungusScript fungusScript = GetFungusScript();
if (!fungusScript.runSlowInEditor)
if (fungusScript.gameObject.activeInHierarchy)
{
if (!runSlowInEditor)
{
activeCommand = nextCommand;
nextCommand.Execute();
@ -122,6 +127,7 @@ namespace Fungus
StartCoroutine(ExecuteAfterDelay(nextCommand, fungusScript.runSlowDuration));
}
}
}
}

Loading…
Cancel
Save