Browse Source

Added protected & virtual to core classes for easier inheritance

master
chrisgregan 11 years ago
parent
commit
53d2fd1aab
  1. 4
      Assets/Fungus/FungusScript/Editor/CallEditor.cs
  2. 4
      Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs
  3. 19
      Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs
  4. 26
      Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs
  5. 14
      Assets/Fungus/FungusScript/Editor/IfEditor.cs
  6. 10
      Assets/Fungus/FungusScript/Editor/SequenceEditor.cs
  7. 16
      Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs
  8. 2
      Assets/Fungus/FungusScript/Editor/VariableEditor.cs
  9. 2
      Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs
  10. 8
      Assets/Fungus/FungusScript/Scripts/BooleanVariable.cs
  11. 9
      Assets/Fungus/FungusScript/Scripts/Command.cs
  12. 8
      Assets/Fungus/FungusScript/Scripts/FloatVariable.cs
  13. 28
      Assets/Fungus/FungusScript/Scripts/FungusScript.cs
  14. 8
      Assets/Fungus/FungusScript/Scripts/GlobalVariables.cs
  15. 8
      Assets/Fungus/FungusScript/Scripts/IntegerVariable.cs
  16. 10
      Assets/Fungus/FungusScript/Scripts/SceneLoader.cs
  17. 16
      Assets/Fungus/FungusScript/Scripts/Sequence.cs
  18. 8
      Assets/Fungus/FungusScript/Scripts/StringVariable.cs
  19. 4
      Assets/Fungus/FungusScript/Scripts/StringsParser.cs

4
Assets/Fungus/FungusScript/Editor/CallEditor.cs

@ -8,9 +8,9 @@ namespace Fungus
[CustomEditor (typeof(Call))] [CustomEditor (typeof(Call))]
public class CallEditor : CommandEditor public class CallEditor : CommandEditor
{ {
SerializedProperty targetSequenceProp; protected SerializedProperty targetSequenceProp;
void OnEnable() protected virtual void OnEnable()
{ {
targetSequenceProp = serializedObject.FindProperty("targetSequence"); targetSequenceProp = serializedObject.FindProperty("targetSequence");
} }

4
Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs

@ -13,14 +13,14 @@ namespace Fungus
{ {
public class CommandListAdaptor : IReorderableListAdaptor { public class CommandListAdaptor : IReorderableListAdaptor {
private class SetCommandOperation protected class SetCommandOperation
{ {
public Sequence sequence; public Sequence sequence;
public Type commandType; public Type commandType;
public int index; public int index;
} }
private SerializedProperty _arrayProperty; protected SerializedProperty _arrayProperty;
public float fixedItemHeight; public float fixedItemHeight;

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

@ -10,12 +10,12 @@ namespace Fungus
[CustomEditor (typeof(FungusScript))] [CustomEditor (typeof(FungusScript))]
public class FungusScriptEditor : Editor public class FungusScriptEditor : Editor
{ {
SerializedProperty startSequenceProp; protected SerializedProperty startSequenceProp;
SerializedProperty executeOnStartProp; protected SerializedProperty executeOnStartProp;
SerializedProperty settingsProp; protected SerializedProperty settingsProp;
SerializedProperty variablesProp; protected SerializedProperty variablesProp;
void OnEnable() protected virtual void OnEnable()
{ {
startSequenceProp = serializedObject.FindProperty("startSequence"); startSequenceProp = serializedObject.FindProperty("startSequence");
executeOnStartProp = serializedObject.FindProperty("executeOnStart"); executeOnStartProp = serializedObject.FindProperty("executeOnStart");
@ -23,11 +23,6 @@ namespace Fungus
variablesProp = serializedObject.FindProperty("variables"); variablesProp = serializedObject.FindProperty("variables");
} }
public void OnInspectorUpdate()
{
Repaint();
}
public override void OnInspectorGUI() public override void OnInspectorGUI()
{ {
serializedObject.Update(); serializedObject.Update();
@ -91,7 +86,7 @@ namespace Fungus
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }
public void DrawVariablesGUI() public virtual void DrawVariablesGUI()
{ {
FungusScript t = target as FungusScript; FungusScript t = target as FungusScript;
@ -117,7 +112,7 @@ namespace Fungus
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
void AddVariable<T>(object obj) where T : Variable protected virtual void AddVariable<T>(object obj) where T : Variable
{ {
FungusScript fungusScript = obj as FungusScript; FungusScript fungusScript = obj as FungusScript;
if (fungusScript == null) if (fungusScript == null)

26
Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs

@ -8,15 +8,15 @@ namespace Fungus
{ {
public class FungusScriptWindow : EditorWindow public class FungusScriptWindow : EditorWindow
{ {
bool resize = false; protected bool resize = false;
Rect cursorChangeRect; protected Rect cursorChangeRect;
public const float minViewWidth = 350; public const float minViewWidth = 350;
static bool locked = false; static bool locked = false;
static GUIStyle lockButtonStyle; static GUIStyle lockButtonStyle;
static FungusScript activeFungusScript; static FungusScript activeFungusScript;
private List<Sequence> windowSequenceMap = new List<Sequence>(); protected List<Sequence> windowSequenceMap = new List<Sequence>();
[MenuItem("Window/Fungus Script")] [MenuItem("Window/Fungus Script")]
static void Init() static void Init()
@ -41,7 +41,7 @@ namespace Fungus
// Implementing this method causes the padlock image to display on the window // Implementing this method causes the padlock image to display on the window
// https://leahayes.wordpress.com/2013/04/30/adding-the-little-padlock-button-to-your-editorwindow/#more-455 // https://leahayes.wordpress.com/2013/04/30/adding-the-little-padlock-button-to-your-editorwindow/#more-455
void ShowButton(Rect position) { protected virtual void ShowButton(Rect position) {
if (lockButtonStyle == null) if (lockButtonStyle == null)
{ {
lockButtonStyle = "IN LockButton"; lockButtonStyle = "IN LockButton";
@ -49,7 +49,7 @@ namespace Fungus
locked = GUI.Toggle(position, locked, GUIContent.none, lockButtonStyle); locked = GUI.Toggle(position, locked, GUIContent.none, lockButtonStyle);
} }
public void OnInspectorUpdate() public virtual void OnInspectorUpdate()
{ {
Repaint(); Repaint();
} }
@ -72,7 +72,7 @@ namespace Fungus
return null; return null;
} }
void OnGUI() protected virtual void OnGUI()
{ {
FungusScript fungusScript = GetFungusScript(); FungusScript fungusScript = GetFungusScript();
if (fungusScript == null) if (fungusScript == null)
@ -94,7 +94,7 @@ namespace Fungus
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
void DrawScriptView(FungusScript fungusScript) protected virtual void DrawScriptView(FungusScript fungusScript)
{ {
EditorUtility.SetDirty(fungusScript); EditorUtility.SetDirty(fungusScript);
@ -184,7 +184,7 @@ namespace Fungus
GLDraw.EndScrollView(); GLDraw.EndScrollView();
} }
void ResizeViews(FungusScript fungusScript) protected virtual void ResizeViews(FungusScript fungusScript)
{ {
cursorChangeRect = new Rect(this.position.width - fungusScript.commandViewWidth, 0, 4f, this.position.height); cursorChangeRect = new Rect(this.position.width - fungusScript.commandViewWidth, 0, 4f, this.position.height);
@ -209,7 +209,7 @@ namespace Fungus
} }
} }
void DrawSequenceView(FungusScript fungusScript) protected virtual void DrawSequenceView(FungusScript fungusScript)
{ {
GUILayout.Space(5); GUILayout.Space(5);
@ -282,7 +282,7 @@ namespace Fungus
GUILayout.EndScrollView(); GUILayout.EndScrollView();
} }
void CreateSequenceCallback(object item) protected virtual void CreateSequenceCallback(object item)
{ {
FungusScript fungusScript = GetFungusScript(); FungusScript fungusScript = GetFungusScript();
if (fungusScript != null) if (fungusScript != null)
@ -295,7 +295,7 @@ namespace Fungus
} }
} }
void DrawWindow(int windowId) protected virtual void DrawWindow(int windowId)
{ {
// Select sequence when node is clicked // Select sequence when node is clicked
if (!Application.isPlaying && if (!Application.isPlaying &&
@ -333,7 +333,7 @@ namespace Fungus
GUI.DragWindow(); GUI.DragWindow();
} }
void DrawConnections(FungusScript fungusScript, Sequence sequence, bool highlightedOnly) protected virtual void DrawConnections(FungusScript fungusScript, Sequence sequence, bool highlightedOnly)
{ {
if (sequence == null) if (sequence == null)
{ {
@ -372,7 +372,7 @@ namespace Fungus
} }
} }
void DrawRectConnection(Rect rectA, Rect rectB, bool highlight) protected virtual void DrawRectConnection(Rect rectA, Rect rectB, bool highlight)
{ {
Vector2 pointA; Vector2 pointA;
Vector2 pointB; Vector2 pointB;

14
Assets/Fungus/FungusScript/Editor/IfEditor.cs

@ -10,14 +10,14 @@ namespace Fungus
[CustomEditor (typeof(If))] [CustomEditor (typeof(If))]
public class IfEditor : CommandEditor public class IfEditor : CommandEditor
{ {
SerializedProperty variableProp; protected SerializedProperty variableProp;
SerializedProperty compareOperatorProp; protected SerializedProperty compareOperatorProp;
SerializedProperty booleanValueProp; protected SerializedProperty booleanValueProp;
SerializedProperty integerValueProp; protected SerializedProperty integerValueProp;
SerializedProperty floatValueProp; protected SerializedProperty floatValueProp;
SerializedProperty stringValueProp; protected SerializedProperty stringValueProp;
void OnEnable() protected virtual void OnEnable()
{ {
variableProp = serializedObject.FindProperty("variable"); variableProp = serializedObject.FindProperty("variable");
compareOperatorProp = serializedObject.FindProperty("compareOperator"); compareOperatorProp = serializedObject.FindProperty("compareOperator");

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

@ -12,15 +12,15 @@ namespace Fungus
[CustomEditor (typeof(Sequence))] [CustomEditor (typeof(Sequence))]
public class SequenceEditor : Editor public class SequenceEditor : Editor
{ {
SerializedProperty sequenceNameProp; protected SerializedProperty sequenceNameProp;
SerializedProperty descriptionProp; protected SerializedProperty descriptionProp;
void OnEnable() public virtual void OnEnable()
{ {
descriptionProp = serializedObject.FindProperty("description"); descriptionProp = serializedObject.FindProperty("description");
} }
public void DrawSequenceGUI(FungusScript fungusScript) public virtual void DrawSequenceGUI(FungusScript fungusScript)
{ {
if (fungusScript.selectedSequence == null) if (fungusScript.selectedSequence == null)
{ {
@ -82,7 +82,7 @@ namespace Fungus
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }
void UpdateIndentLevels(Sequence sequence) protected virtual void UpdateIndentLevels(Sequence sequence)
{ {
int indentLevel = 0; int indentLevel = 0;
foreach(Command command in sequence.commandList) foreach(Command command in sequence.commandList)

16
Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs

@ -9,14 +9,14 @@ namespace Fungus
[CustomEditor (typeof(SetVariable))] [CustomEditor (typeof(SetVariable))]
public class SetVariableEditor : CommandEditor public class SetVariableEditor : CommandEditor
{ {
SerializedProperty variableProp; protected SerializedProperty variableProp;
SerializedProperty setOperatorProp; protected SerializedProperty setOperatorProp;
SerializedProperty booleanDataProp; protected SerializedProperty booleanDataProp;
SerializedProperty integerDataProp; protected SerializedProperty integerDataProp;
SerializedProperty floatDataProp; protected SerializedProperty floatDataProp;
SerializedProperty stringDataProp; protected SerializedProperty stringDataProp;
void OnEnable() protected virtual void OnEnable()
{ {
variableProp = serializedObject.FindProperty("variable"); variableProp = serializedObject.FindProperty("variable");
setOperatorProp = serializedObject.FindProperty("setOperator"); setOperatorProp = serializedObject.FindProperty("setOperator");

2
Assets/Fungus/FungusScript/Editor/VariableEditor.cs

@ -11,7 +11,7 @@ namespace Fungus
[CustomEditor (typeof(Variable), true)] [CustomEditor (typeof(Variable), true)]
public class VariableEditor : CommandEditor public class VariableEditor : CommandEditor
{ {
void OnEnable() protected virtual void OnEnable()
{ {
Variable t = target as Variable; Variable t = target as Variable;
t.hideFlags = HideFlags.HideInInspector; t.hideFlags = HideFlags.HideInInspector;

2
Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs

@ -11,7 +11,7 @@ namespace Fungus
{ {
public class VariableListAdaptor : IReorderableListAdaptor { public class VariableListAdaptor : IReorderableListAdaptor {
private SerializedProperty _arrayProperty; protected SerializedProperty _arrayProperty;
public float fixedItemHeight; public float fixedItemHeight;

8
Assets/Fungus/FungusScript/Scripts/BooleanVariable.cs

@ -7,7 +7,7 @@ namespace Fungus
public class BooleanVariable : Variable public class BooleanVariable : Variable
{ {
bool booleanValue; protected bool booleanValue;
public bool Value public bool Value
{ {
@ -20,10 +20,10 @@ namespace Fungus
public class BooleanData public class BooleanData
{ {
[SerializeField] [SerializeField]
BooleanVariable booleanReference; protected BooleanVariable booleanReference;
[SerializeField] [SerializeField]
bool booleanValue; protected bool booleanValue;
public bool Value public bool Value
{ {
@ -31,7 +31,7 @@ namespace Fungus
set { if (booleanReference == null) { booleanValue = value; } else { booleanReference.Value = value; } } set { if (booleanReference == null) { booleanValue = value; } else { booleanReference.Value = value; } }
} }
public string GetDescription() public virtual string GetDescription()
{ {
if (booleanReference == null) if (booleanReference == null)
{ {

9
Assets/Fungus/FungusScript/Scripts/Command.cs

@ -1,6 +1,3 @@
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine; using UnityEngine;
using System; using System;
using System.Collections; using System.Collections;
@ -32,12 +29,12 @@ namespace Fungus
[HideInInspector] [HideInInspector]
public int indentLevel; public int indentLevel;
public Sequence GetSequence() public virtual Sequence GetSequence()
{ {
return gameObject.GetComponent<Sequence>(); return gameObject.GetComponent<Sequence>();
} }
public FungusScript GetFungusScript() public virtual FungusScript GetFungusScript()
{ {
Sequence s = GetSequence(); Sequence s = GetSequence();
if (s == null) if (s == null)
@ -48,7 +45,7 @@ namespace Fungus
return s.GetFungusScript(); return s.GetFungusScript();
} }
public bool IsExecuting() public virtual bool IsExecuting()
{ {
Sequence sequence = GetSequence(); Sequence sequence = GetSequence();
if (sequence == null) if (sequence == null)

8
Assets/Fungus/FungusScript/Scripts/FloatVariable.cs

@ -6,7 +6,7 @@ namespace Fungus
public class FloatVariable : Variable public class FloatVariable : Variable
{ {
float floatValue; protected float floatValue;
public float Value public float Value
{ {
@ -19,10 +19,10 @@ namespace Fungus
public class FloatData public class FloatData
{ {
[SerializeField] [SerializeField]
FloatVariable floatReference; protected FloatVariable floatReference;
[SerializeField] [SerializeField]
float floatValue; protected float floatValue;
public float Value public float Value
{ {
@ -30,7 +30,7 @@ namespace Fungus
set { if (floatReference == null) { floatValue = value; } else { floatReference.Value = value; } } set { if (floatReference == null) { floatValue = value; } else { floatReference.Value = value; } }
} }
public string GetDescription() public virtual string GetDescription()
{ {
if (floatReference == null) if (floatReference == null)
{ {

28
Assets/Fungus/FungusScript/Scripts/FungusScript.cs

@ -109,7 +109,7 @@ namespace Fungus
[Tooltip("Advanced configuration options for the Fungus Script")] [Tooltip("Advanced configuration options for the Fungus Script")]
public Settings settings; public Settings settings;
void Start() protected virtual void Start()
{ {
if (executeOnStart) if (executeOnStart)
{ {
@ -120,7 +120,7 @@ namespace Fungus
/** /**
* Create a new sequence node which you can then add commands to. * Create a new sequence node which you can then add commands to.
*/ */
public Sequence CreateSequence(Vector2 position) public virtual Sequence CreateSequence(Vector2 position)
{ {
GameObject go = new GameObject("Sequence"); GameObject go = new GameObject("Sequence");
go.transform.parent = transform; go.transform.parent = transform;
@ -134,7 +134,7 @@ namespace Fungus
/** /**
* Start running the Fungus Script by executing the startSequence. * Start running the Fungus Script by executing the startSequence.
*/ */
public void Execute() public virtual void Execute()
{ {
if (startSequence == null) if (startSequence == null)
{ {
@ -147,7 +147,7 @@ namespace Fungus
/** /**
* Start running the Fungus Script by executing a specific child sequence. * Start running the Fungus Script by executing a specific child sequence.
*/ */
public void ExecuteSequence(Sequence sequence) public virtual void ExecuteSequence(Sequence sequence)
{ {
// Sequence must be a child of the parent Fungus Script // Sequence must be a child of the parent Fungus Script
if (sequence == null || if (sequence == null ||
@ -164,7 +164,7 @@ namespace Fungus
/** /**
* Returns a new variable key that is guaranteed not to clash with any existing variable in the list. * Returns a new variable key that is guaranteed not to clash with any existing variable in the list.
*/ */
public string GetUniqueVariableKey(string originalKey, Variable ignoreVariable = null) public virtual string GetUniqueVariableKey(string originalKey, Variable ignoreVariable = null)
{ {
int suffix = 0; int suffix = 0;
string baseKey = originalKey; string baseKey = originalKey;
@ -213,7 +213,7 @@ namespace Fungus
* Gets the value of a boolean variable. * Gets the value of a boolean variable.
* Returns false if the variable key does not exist. * Returns false if the variable key does not exist.
*/ */
public bool GetBooleanVariable(string key) public virtual bool GetBooleanVariable(string key)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -234,7 +234,7 @@ namespace Fungus
* Sets the value of a boolean variable. * Sets the value of a boolean variable.
* The variable must already be added to the list of variables for this Fungus Script. * The variable must already be added to the list of variables for this Fungus Script.
*/ */
public void SetBooleanVariable(string key, bool value) public virtual void SetBooleanVariable(string key, bool value)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -255,7 +255,7 @@ namespace Fungus
* Gets the value of an integer variable. * Gets the value of an integer variable.
* Returns false if the variable key does not exist. * Returns false if the variable key does not exist.
*/ */
public int GetIntegerVariable(string key) public virtual int GetIntegerVariable(string key)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -276,7 +276,7 @@ namespace Fungus
* Sets the value of an integer variable. * Sets the value of an integer variable.
* The variable must already be added to the list of variables for this Fungus Script. * The variable must already be added to the list of variables for this Fungus Script.
*/ */
public void SetIntegerVariable(string key, int value) public virtual void SetIntegerVariable(string key, int value)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -297,7 +297,7 @@ namespace Fungus
* Gets the value of a float variable. * Gets the value of a float variable.
* Returns false if the variable key does not exist. * Returns false if the variable key does not exist.
*/ */
public float GetFloatVariable(string key) public virtual float GetFloatVariable(string key)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -318,7 +318,7 @@ namespace Fungus
* Sets the value of a float variable. * Sets the value of a float variable.
* The variable must already be added to the list of variables for this Fungus Script. * The variable must already be added to the list of variables for this Fungus Script.
*/ */
public void SetFloatVariable(string key, float value) public virtual void SetFloatVariable(string key, float value)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -339,7 +339,7 @@ namespace Fungus
* Gets the value of a string variable. * Gets the value of a string variable.
* Returns false if the variable key does not exist. * Returns false if the variable key does not exist.
*/ */
public string GetStringVariable(string key) public virtual string GetStringVariable(string key)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -360,7 +360,7 @@ namespace Fungus
* Sets the value of a string variable. * Sets the value of a string variable.
* The variable must already be added to the list of variables for this Fungus Script. * The variable must already be added to the list of variables for this Fungus Script.
*/ */
public void SetStringVariable(string key, string value) public virtual void SetStringVariable(string key, string value)
{ {
foreach (Variable v in variables) foreach (Variable v in variables)
{ {
@ -380,7 +380,7 @@ namespace Fungus
/** /**
* Set the sequence objects to be hidden or visible depending on the showSequenceObjects property. * Set the sequence objects to be hidden or visible depending on the showSequenceObjects property.
*/ */
public void UpdateHideFlags() public virtual void UpdateHideFlags()
{ {
Sequence[] sequences = GetComponentsInChildren<Sequence>(); Sequence[] sequences = GetComponentsInChildren<Sequence>();
foreach (Sequence sequence in sequences) foreach (Sequence sequence in sequences)

8
Assets/Fungus/FungusScript/Scripts/GlobalVariables.cs

@ -16,10 +16,10 @@ namespace Fungus
*/ */
public class GlobalVariables public class GlobalVariables
{ {
static Dictionary<string, string> stringDict = new Dictionary<string, string>(); protected static Dictionary<string, string> stringDict = new Dictionary<string, string>();
static Dictionary<string, int> intDict = new Dictionary<string, int>(); protected static Dictionary<string, int> intDict = new Dictionary<string, int>();
static Dictionary<string, float> floatDict = new Dictionary<string, float>(); protected static Dictionary<string, float> floatDict = new Dictionary<string, float>();
static Dictionary<string, bool> boolDict = new Dictionary<string, bool>(); protected static Dictionary<string, bool> boolDict = new Dictionary<string, bool>();
/** /**
* Save the variable dictionaries to persistent storage using a name tag. * Save the variable dictionaries to persistent storage using a name tag.

8
Assets/Fungus/FungusScript/Scripts/IntegerVariable.cs

@ -6,7 +6,7 @@ namespace Fungus
public class IntegerVariable : Variable public class IntegerVariable : Variable
{ {
int integerValue; protected int integerValue;
public int Value public int Value
{ {
@ -19,10 +19,10 @@ namespace Fungus
public class IntegerData public class IntegerData
{ {
[SerializeField] [SerializeField]
IntegerVariable integerReference; protected IntegerVariable integerReference;
[SerializeField] [SerializeField]
int integerValue; protected int integerValue;
public int Value public int Value
{ {
@ -30,7 +30,7 @@ namespace Fungus
set { if (integerReference == null) { integerValue = value; } else { integerReference.Value = value; } } set { if (integerReference == null) { integerValue = value; } else { integerReference.Value = value; } }
} }
public string GetDescription() public virtual string GetDescription()
{ {
if (integerReference == null) if (integerReference == null)
{ {

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

@ -12,9 +12,9 @@ namespace Fungus
*/ */
public class SceneLoader : MonoBehaviour public class SceneLoader : MonoBehaviour
{ {
Texture2D loadingTexture; protected Texture2D loadingTexture;
string sceneToLoad; protected string sceneToLoad;
bool displayedImage; protected bool displayedImage;
/** /**
* Asynchronously load a new scene. * Asynchronously load a new scene.
@ -32,7 +32,7 @@ namespace Fungus
sceneLoader.loadingTexture = _loadingTexture; sceneLoader.loadingTexture = _loadingTexture;
} }
void Start() protected virtual void Start()
{ {
StartCoroutine(DoLoadSequence()); StartCoroutine(DoLoadSequence());
} }
@ -77,7 +77,7 @@ namespace Fungus
Destroy(gameObject); Destroy(gameObject);
} }
void OnGUI() protected virtual void OnGUI()
{ {
if (loadingTexture == null) if (loadingTexture == null)
{ {

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

@ -21,14 +21,14 @@ namespace Fungus
public List<Command> commandList = new List<Command>(); public List<Command> commandList = new List<Command>();
int executionCount; protected int executionCount;
public FungusScript GetFungusScript() public virtual FungusScript GetFungusScript()
{ {
return GetComponentInParent<FungusScript>(); return GetComponentInParent<FungusScript>();
} }
public bool HasError() public virtual bool HasError()
{ {
foreach (Command command in commandList) foreach (Command command in commandList)
{ {
@ -41,7 +41,7 @@ namespace Fungus
return false; return false;
} }
public bool IsRunning() public virtual bool IsRunning()
{ {
FungusScript fungusScript = GetFungusScript(); FungusScript fungusScript = GetFungusScript();
@ -54,12 +54,12 @@ namespace Fungus
return (fungusScript.executingSequence == this); return (fungusScript.executingSequence == this);
} }
public int GetExecutionCount() public virtual int GetExecutionCount()
{ {
return executionCount; return executionCount;
} }
public void ExecuteNextCommand(Command currentCommand = null) public virtual void ExecuteNextCommand(Command currentCommand = null)
{ {
if (currentCommand == null) if (currentCommand == null)
{ {
@ -114,7 +114,7 @@ namespace Fungus
command.Execute(); command.Execute();
} }
public void Stop() public virtual void Stop()
{ {
FungusScript fungusScript = GetFungusScript(); FungusScript fungusScript = GetFungusScript();
if (fungusScript == null) if (fungusScript == null)
@ -128,7 +128,7 @@ namespace Fungus
fungusScript.selectedCommand = null; fungusScript.selectedCommand = null;
} }
public List<Sequence> GetConnectedSequences() public virtual List<Sequence> GetConnectedSequences()
{ {
List<Sequence> connectedSequences = new List<Sequence>(); List<Sequence> connectedSequences = new List<Sequence>();
foreach (Command command in commandList) foreach (Command command in commandList)

8
Assets/Fungus/FungusScript/Scripts/StringVariable.cs

@ -6,7 +6,7 @@ namespace Fungus
public class StringVariable : Variable public class StringVariable : Variable
{ {
string stringValue; protected string stringValue;
public string Value public string Value
{ {
@ -19,10 +19,10 @@ namespace Fungus
public class StringData public class StringData
{ {
[SerializeField] [SerializeField]
StringVariable stringReference; protected StringVariable stringReference;
[SerializeField] [SerializeField]
string stringValue; protected string stringValue;
public string Value public string Value
{ {
@ -30,7 +30,7 @@ namespace Fungus
set { if (stringReference == null) { stringValue = value; } else { stringReference.Value = value; } } set { if (stringReference == null) { stringValue = value; } else { stringReference.Value = value; } }
} }
public string GetDescription() public virtual string GetDescription()
{ {
if (stringReference == null) if (stringReference == null)
{ {

4
Assets/Fungus/FungusScript/Scripts/StringsParser.cs

@ -25,12 +25,12 @@ namespace Fungus
Text, Text,
}; };
void Start() public virtual void Start()
{ {
ProcessText(stringsFile.text); ProcessText(stringsFile.text);
} }
void ProcessText(string text) protected virtual void ProcessText(string text)
{ {
// Split text into lines. Add a newline at end to ensure last command is always parsed // Split text into lines. Add a newline at end to ensure last command is always parsed
string[] lines = Regex.Split(text + "\n", "(?<=\n)"); string[] lines = Regex.Split(text + "\n", "(?<=\n)");

Loading…
Cancel
Save