diff --git a/Assets/Fungus/Editor/CompareCommandEditor.cs b/Assets/Fungus/Editor/CompareCommandEditor.cs index 135dbec9..835467bf 100644 --- a/Assets/Fungus/Editor/CompareCommandEditor.cs +++ b/Assets/Fungus/Editor/CompareCommandEditor.cs @@ -1,4 +1,4 @@ -using UnityEditor; +using UnityEditor; using UnityEngine; using System.Collections; using System.Collections.Generic; @@ -13,7 +13,7 @@ namespace Fungus { CompareCommand t = target as CompareCommand; - SequenceController sc = t.GetParentSequenceController(); + FungusScript sc = t.GetParentFungusScript(); if (sc == null) { return; @@ -115,11 +115,11 @@ namespace Fungus } Sequence onTrue = SequenceEditor.SequenceField(new GUIContent("On True Sequence", "Sequence to execute if comparision is true"), - t.GetParentSequenceController(), + t.GetParentFungusScript(), t.onTrueSequence); Sequence onFalse = SequenceEditor.SequenceField(new GUIContent("On False Sequence", "Sequence to execute if comparision is false"), - t.GetParentSequenceController(), + t.GetParentFungusScript(), t.onFalseSequence); if (onTrue != t.onTrueSequence) diff --git a/Assets/Fungus/Editor/FungusEditorWindow.cs b/Assets/Fungus/Editor/FungusEditorWindow.cs index 1bf44431..e0b7d04f 100755 --- a/Assets/Fungus/Editor/FungusEditorWindow.cs +++ b/Assets/Fungus/Editor/FungusEditorWindow.cs @@ -25,19 +25,19 @@ public class FungusEditorWindow : EditorWindow Repaint(); } - SequenceController GetSequenceController() + FungusScript GetFungusScript() { GameObject activeObject = Selection.activeGameObject; while (activeObject != null) { - SequenceController sequenceController = activeObject.GetComponent(); + FungusScript fungusScript = activeObject.GetComponent(); Sequence sequence = activeObject.GetComponent(); - if (sequenceController != null) + if (fungusScript != null) { // Found sequence controller - return sequenceController; + return fungusScript; } else if (sequence != null && sequence.transform.parent != null) @@ -56,13 +56,13 @@ public class FungusEditorWindow : EditorWindow void OnGUI() { - SequenceController sequenceController = GetSequenceController(); - if (sequenceController == null) + FungusScript fungusScript = GetFungusScript(); + if (fungusScript == null) { return; } - Sequence[] sequences = sequenceController.GetComponentsInChildren(); + Sequence[] sequences = fungusScript.GetComponentsInChildren(); Rect scrollViewRect = new Rect(); @@ -110,10 +110,10 @@ public class FungusEditorWindow : EditorWindow GUI.EndScrollView(); - string labelText = sequenceController.name; + string labelText = fungusScript.name; if (Application.isPlaying) { - if (sequenceController.activeSequence == null) + if (fungusScript.activeSequence == null) { labelText += " (Idle)"; } @@ -133,7 +133,7 @@ public class FungusEditorWindow : EditorWindow GUILayout.Space(15); if (GUILayout.Button(labelText)) { - Selection.activeGameObject = sequenceController.gameObject; + Selection.activeGameObject = fungusScript.gameObject; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); diff --git a/Assets/Fungus/Editor/SequenceControllerEditor.cs b/Assets/Fungus/Editor/FungusScriptEditor.cs similarity index 94% rename from Assets/Fungus/Editor/SequenceControllerEditor.cs rename to Assets/Fungus/Editor/FungusScriptEditor.cs index 53b77ef4..260ebb81 100644 --- a/Assets/Fungus/Editor/SequenceControllerEditor.cs +++ b/Assets/Fungus/Editor/FungusScriptEditor.cs @@ -1,4 +1,4 @@ -using UnityEditor; +using UnityEditor; using UnityEngine; using System.Collections; using System.Collections.Generic; @@ -39,8 +39,8 @@ public class VariableDrawer : PropertyDrawer } } -[CustomEditor (typeof(SequenceController))] -public class SequenceControllerEditor : Editor +[CustomEditor (typeof(FungusScript))] +public class FungusScriptEditor : Editor { SerializedProperty variablesProperty; @@ -53,7 +53,7 @@ public class SequenceControllerEditor : Editor { serializedObject.Update(); - SequenceController t = target as SequenceController; + FungusScript t = target as FungusScript; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); diff --git a/Assets/Fungus/Editor/SequenceControllerEditor.cs.meta b/Assets/Fungus/Editor/FungusScriptEditor.cs.meta similarity index 100% rename from Assets/Fungus/Editor/SequenceControllerEditor.cs.meta rename to Assets/Fungus/Editor/FungusScriptEditor.cs.meta diff --git a/Assets/Fungus/Editor/SequenceEditor.cs b/Assets/Fungus/Editor/SequenceEditor.cs index 9a5d15cb..e6ab674a 100644 --- a/Assets/Fungus/Editor/SequenceEditor.cs +++ b/Assets/Fungus/Editor/SequenceEditor.cs @@ -8,9 +8,9 @@ using Fungus; public class SequenceEditor : Editor { - static public Sequence SequenceField(GUIContent label, SequenceController sequenceController, Sequence sequence) + static public Sequence SequenceField(GUIContent label, FungusScript fungusScript, Sequence sequence) { - if (sequenceController == null) + if (fungusScript == null) { return null; } @@ -22,7 +22,7 @@ public class SequenceEditor : Editor int selectedIndex = 0; sequenceNames.Add(new GUIContent("")); - Sequence[] sequences = sequenceController.GetComponentsInChildren(); + Sequence[] sequences = fungusScript.GetComponentsInChildren(); for (int i = 0; i < sequences.Length; ++i) { sequenceNames.Add(new GUIContent(sequences[i].name)); diff --git a/Assets/Fungus/Editor/SetVariableCommandEditor.cs b/Assets/Fungus/Editor/SetVariableCommandEditor.cs index fc7d44be..a37ba0c1 100644 --- a/Assets/Fungus/Editor/SetVariableCommandEditor.cs +++ b/Assets/Fungus/Editor/SetVariableCommandEditor.cs @@ -1,4 +1,4 @@ -using UnityEditor; +using UnityEditor; using UnityEngine; using System.Collections; using System.Collections.Generic; @@ -13,7 +13,7 @@ namespace Fungus { SetVariableCommand t = target as SetVariableCommand; - SequenceController sc = t.GetParentSequenceController(); + FungusScript sc = t.GetParentFungusScript(); if (sc == null) { return; diff --git a/Assets/Fungus/Tests/Sequence/SequenceTest.unity b/Assets/Fungus/Tests/Sequence/SequenceTest.unity index 926f6ac4..d6ff97a7 100644 Binary files a/Assets/Fungus/Tests/Sequence/SequenceTest.unity and b/Assets/Fungus/Tests/Sequence/SequenceTest.unity differ diff --git a/Assets/Fungus/Tests/Sequence/SequenceTestRoom.cs b/Assets/Fungus/Tests/Sequence/SequenceTestRoom.cs index 53ccb729..24a7bb32 100644 --- a/Assets/Fungus/Tests/Sequence/SequenceTestRoom.cs +++ b/Assets/Fungus/Tests/Sequence/SequenceTestRoom.cs @@ -4,11 +4,11 @@ using Fungus; public class SequenceTestRoom : Room { - public SequenceController sequenceController; + public FungusScript fungusScript; void OnEnter() { - sequenceController.Execute(); + fungusScript.Execute(); /* Sequence s = GetComponent(); diff --git a/Assets/Fungus/VisualScripting/CompareCommand.cs b/Assets/Fungus/VisualScripting/CompareCommand.cs index 50402734..5d8185cb 100644 --- a/Assets/Fungus/VisualScripting/CompareCommand.cs +++ b/Assets/Fungus/VisualScripting/CompareCommand.cs @@ -35,7 +35,7 @@ namespace Fungus public override void OnEnter() { - Variable v = parentSequenceController.GetVariable(variableKey); + Variable v = parentFungusScript.GetVariable(variableKey); bool condition = false; diff --git a/Assets/Fungus/VisualScripting/FungusCommand.cs b/Assets/Fungus/VisualScripting/FungusCommand.cs index dfb0179a..fbbb8230 100644 --- a/Assets/Fungus/VisualScripting/FungusCommand.cs +++ b/Assets/Fungus/VisualScripting/FungusCommand.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR +#if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; @@ -14,7 +14,7 @@ namespace Fungus public string errorMessage = ""; [HideInInspector] - public SequenceController parentSequenceController; + public FungusScript parentFungusScript; [HideInInspector] public Sequence parentSequence; @@ -22,17 +22,17 @@ namespace Fungus public virtual void Start() { parentSequence = GetComponent(); - parentSequenceController = GetParentSequenceController(); + parentFungusScript = GetParentFungusScript(); } - public SequenceController GetParentSequenceController() + public FungusScript GetParentFungusScript() { - SequenceController sc = null; + FungusScript sc = null; Transform parent = transform.parent; while (parent != null) { - sc = parent.gameObject.GetComponent(); + sc = parent.gameObject.GetComponent(); if (sc != null) { break; @@ -67,7 +67,7 @@ namespace Fungus { OnExit(); parentSequence.Finish(); - parentSequenceController.ExecuteSequence(s); + parentFungusScript.ExecuteSequence(s); } public virtual void OnEnter() diff --git a/Assets/Fungus/VisualScripting/SequenceController.cs b/Assets/Fungus/VisualScripting/FungusScript.cs similarity index 94% rename from Assets/Fungus/VisualScripting/SequenceController.cs rename to Assets/Fungus/VisualScripting/FungusScript.cs index bd4f0c49..5dd725c3 100644 --- a/Assets/Fungus/VisualScripting/SequenceController.cs +++ b/Assets/Fungus/VisualScripting/FungusScript.cs @@ -7,7 +7,7 @@ using System.Collections; using System.Collections.Generic; using Fungus; -public class SequenceController : MonoBehaviour +public class FungusScript : MonoBehaviour { public float stepTime; diff --git a/Assets/Fungus/VisualScripting/SequenceController.cs.meta b/Assets/Fungus/VisualScripting/FungusScript.cs.meta similarity index 100% rename from Assets/Fungus/VisualScripting/SequenceController.cs.meta rename to Assets/Fungus/VisualScripting/FungusScript.cs.meta diff --git a/Assets/Fungus/VisualScripting/Sequence.cs b/Assets/Fungus/VisualScripting/Sequence.cs index b52f8cc0..7c6c0d8c 100644 --- a/Assets/Fungus/VisualScripting/Sequence.cs +++ b/Assets/Fungus/VisualScripting/Sequence.cs @@ -17,23 +17,23 @@ namespace Fungus public Rect nodeRect = new Rect(10, 10, 100, 100); [System.NonSerialized] - public SequenceController sequenceController; + public FungusScript fungusScript; [System.NonSerialized] public FungusCommand activeCommand; public virtual void Start() { - sequenceController = GetSequenceController(); + fungusScript = GetFungusScript(); } - public SequenceController GetSequenceController() + public FungusScript GetFungusScript() { - SequenceController sc = null; + FungusScript sc = null; Transform parent = transform.parent; while (parent != null) { - sc = parent.gameObject.GetComponent(); + sc = parent.gameObject.GetComponent(); if (sc != null) { break; @@ -58,13 +58,13 @@ namespace Fungus public bool IsRunning() { - if (sequenceController == null || - sequenceController.activeSequence == null) + if (fungusScript == null || + fungusScript.activeSequence == null) { return false; } - return (sequenceController.activeSequence == this); + return (fungusScript.activeSequence == this); } public void ExecuteNextCommand(FungusCommand currentCommand = null) @@ -93,14 +93,14 @@ namespace Fungus } else { - if (sequenceController.stepTime == 0f) + if (fungusScript.stepTime == 0f) { activeCommand = nextCommand; nextCommand.Execute(); } else { - StartCoroutine(ExecuteAfterDelay(nextCommand, sequenceController.stepTime)); + StartCoroutine(ExecuteAfterDelay(nextCommand, fungusScript.stepTime)); } } @@ -116,11 +116,11 @@ namespace Fungus public void Finish() { activeCommand = null; - sequenceController.activeSequence = null; + fungusScript.activeSequence = null; // No more commands to run in current sequence #if UNITY_EDITOR - Selection.activeGameObject = sequenceController.gameObject; + Selection.activeGameObject = fungusScript.gameObject; #endif } } diff --git a/Assets/Fungus/VisualScripting/SetVariableCommand.cs b/Assets/Fungus/VisualScripting/SetVariableCommand.cs index 0c67e05c..ea04a86c 100644 --- a/Assets/Fungus/VisualScripting/SetVariableCommand.cs +++ b/Assets/Fungus/VisualScripting/SetVariableCommand.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; using Fungus; @@ -22,7 +22,7 @@ public class SetVariableCommand : FungusCommand return; } - Variable v = parentSequenceController.GetVariable(variableKey); + Variable v = parentFungusScript.GetVariable(variableKey); if (v == null) { Debug.LogError("Variable " + variableKey + " not defined.");