From da678c640b31238c4c1f1092739bed429482cdd2 Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 23 Aug 2016 15:16:21 +0100 Subject: [PATCH] Refactored comments --- Assets/Fungus/Flowchart/Scripts/Block.cs | 82 +++- Assets/Fungus/Flowchart/Scripts/Command.cs | 168 ++++--- .../Flowchart/Scripts/CommandCopyBuffer.cs | 13 +- .../Flowchart/Scripts/Commands/Break.cs | 6 +- .../Fungus/Flowchart/Scripts/Commands/Call.cs | 5 +- .../Flowchart/Scripts/Commands/CallMethod.cs | 9 +- .../Flowchart/Scripts/Commands/Comment.cs | 5 +- .../Flowchart/Scripts/Commands/Condition.cs | 2 - .../Flowchart/Scripts/Commands/DebugLog.cs | 4 +- .../Scripts/Commands/DeleteSaveKey.cs | 5 +- .../Flowchart/Scripts/Commands/Destroy.cs | 5 +- .../Fungus/Flowchart/Scripts/Commands/Else.cs | 5 +- .../Flowchart/Scripts/Commands/ElseIf.cs | 8 +- .../Fungus/Flowchart/Scripts/Commands/End.cs | 6 +- .../Fungus/Flowchart/Scripts/Commands/If.cs | 6 +- .../Flowchart/Scripts/Commands/InvokeEvent.cs | 9 +- .../Scripts/Commands/InvokeMethod.cs | 9 +- .../Fungus/Flowchart/Scripts/Commands/Jump.cs | 3 + .../Flowchart/Scripts/Commands/Label.cs | 5 +- .../Flowchart/Scripts/Commands/LoadScene.cs | 20 +- .../Scripts/Commands/LoadVariable.cs | 5 +- .../Flowchart/Scripts/Commands/OpenURL.cs | 5 +- .../Fungus/Flowchart/Scripts/Commands/Quit.cs | 5 +- .../Flowchart/Scripts/Commands/RandomFloat.cs | 4 +- .../Scripts/Commands/RandomInteger.cs | 4 +- .../Scripts/Commands/ReadTextFile.cs | 5 +- .../Flowchart/Scripts/Commands/Reset.cs | 5 +- .../Scripts/Commands/SaveVariable.cs | 7 +- .../Flowchart/Scripts/Commands/SendMessage.cs | 4 +- .../Flowchart/Scripts/Commands/SetActive.cs | 5 +- .../Scripts/Commands/SetSaveProfile.cs | 3 + .../Flowchart/Scripts/Commands/SetVariable.cs | 5 +- .../Flowchart/Scripts/Commands/SpawnObject.cs | 7 +- .../Fungus/Flowchart/Scripts/Commands/Stop.cs | 5 +- .../Flowchart/Scripts/Commands/StopBlock.cs | 5 +- .../Scripts/Commands/StopFlowchart.cs | 4 +- .../Fungus/Flowchart/Scripts/Commands/Wait.cs | 5 +- .../Flowchart/Scripts/Commands/While.cs | 6 +- .../Fungus/Flowchart/Scripts/EventHandler.cs | 39 +- .../Scripts/EventHandlers/FlowchartEnabled.cs | 6 +- .../Scripts/EventHandlers/GameStarted.cs | 6 +- .../Scripts/EventHandlers/KeyPressed.cs | 4 +- .../Scripts/EventHandlers/MessageReceived.cs | 4 +- Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 428 +++++++++--------- .../Fungus/Flowchart/Scripts/FungusState.cs | 9 +- Assets/Fungus/Flowchart/Scripts/Node.cs | 7 +- .../Fungus/Flowchart/Scripts/SceneLoader.cs | 23 +- .../Flowchart/Scripts/StringFormatter.cs | 6 +- Assets/Fungus/Flowchart/Scripts/Variable.cs | 20 +- .../Scripts/VariableTypes/AnimatorVariable.cs | 7 +- .../VariableTypes/AudioSourceVariable.cs | 7 +- .../Scripts/VariableTypes/BooleanVariable.cs | 7 +- .../Scripts/VariableTypes/ColorVariable.cs | 6 + .../Scripts/VariableTypes/FloatVariable.cs | 6 + .../VariableTypes/GameObjectVariable.cs | 6 + .../Scripts/VariableTypes/IntegerVariable.cs | 6 + .../Scripts/VariableTypes/MaterialVariable.cs | 6 + .../Scripts/VariableTypes/ObjectVariable.cs | 6 + .../Scripts/VariableTypes/SpriteVariable.cs | 6 + .../Scripts/VariableTypes/StringVariable.cs | 8 +- .../Scripts/VariableTypes/TextureVariable.cs | 6 + .../VariableTypes/TransformVariable.cs | 6 + .../Scripts/VariableTypes/Vector2Variable.cs | 6 + .../Scripts/VariableTypes/Vector3Variable.cs | 6 + 64 files changed, 667 insertions(+), 444 deletions(-) diff --git a/Assets/Fungus/Flowchart/Scripts/Block.cs b/Assets/Fungus/Flowchart/Scripts/Block.cs index cb18b76a..17e8d562 100644 --- a/Assets/Fungus/Flowchart/Scripts/Block.cs +++ b/Assets/Fungus/Flowchart/Scripts/Block.cs @@ -11,6 +11,9 @@ using System.Collections.Generic; namespace Fungus { + /// + /// A container for a sequence of Fungus comands. + /// [ExecuteInEditMode] [RequireComponent(typeof(Flowchart))] [AddComponentMenu("")] @@ -22,58 +25,72 @@ namespace Fungus Executing, } + /// + /// The execution state of the Block. + /// protected ExecutionState executionState; - public ExecutionState State { get { return executionState; } } + /// + /// Unique identifier for the Block. + /// [SerializeField] protected int itemId = -1; // Invalid flowchart item id - public int ItemId { get { return itemId; } set { itemId = value; } } + /// + /// The name of the block node as displayed in the Flowchart window. + /// [FormerlySerializedAs("sequenceName")] [Tooltip("The name of the block node as displayed in the Flowchart window")] [SerializeField] protected string blockName = "New Block"; - public string BlockName { get { return blockName; } set { blockName = value; } } + /// + /// Description text to display under the block node + /// [TextArea(2, 5)] [Tooltip("Description text to display under the block node")] [SerializeField] protected string description = ""; - public string Description { get { return description; } } + /// + /// An optional Event Handler which can execute the block when an event occurs. + /// [Tooltip("An optional Event Handler which can execute the block when an event occurs")] [SerializeField] protected EventHandler eventHandler; - public EventHandler _EventHandler { get { return eventHandler; } set { eventHandler = value; } } + /// + /// The currently executing command. + /// protected Command activeCommand; - public Command ActiveCommand { get { return activeCommand; } } - // Index of last command executed before the current one - // -1 indicates no previous command + /// + // Index of last command executed before the current one. + // -1 indicates no previous command. + /// protected int previousActiveCommandIndex = -1; - public float ExecutingIconTimer { get; set; } + /// + /// The list of commands in the sequence. + /// [SerializeField] protected List commandList = new List(); - public List CommandList { get { return commandList; } } - protected int executionCount; + /// + /// Controls the next command to execute in the block execution coroutine. + /// + protected int jumpToCommandIndex = -1; + public int JumpToCommandIndex { set { jumpToCommandIndex = value; } } - /** - * Duration of fade for executing icon displayed beside blocks & commands. - */ + /// + /// Duration of fade for executing icon displayed beside blocks & commands. + /// public const float executingIconFadeTime = 0.5f; - /** - * Controls the next command to execute in the block execution coroutine. - */ - protected int jumpToCommandIndex = -1; - - public int JumpToCommandIndex { set { jumpToCommandIndex = value; } } + protected int executionCount; protected bool executionInfoSet = false; @@ -82,6 +99,9 @@ namespace Fungus SetExecutionInfo(); } + /// + /// Populate the command metadata used to control execution. + /// protected virtual void SetExecutionInfo() { // Give each child command a reference back to its parent block @@ -125,16 +145,25 @@ namespace Fungus } #endif + /// + /// Returns the parent Flowchart for this Block. + /// public virtual Flowchart GetFlowchart() { return GetComponent(); } + /// + /// Returns true if the Block is executing a command. + /// public virtual bool IsExecuting() { return (executionState == ExecutionState.Executing); } + /// + /// Returns the number of times this Block has executed. + /// public virtual int GetExecutionCount() { return executionCount; @@ -261,6 +290,9 @@ namespace Fungus } } + /// + /// Stop executing commands in this Block. + /// public virtual void Stop() { // Tell the executing command to stop immediately @@ -274,6 +306,9 @@ namespace Fungus jumpToCommandIndex = int.MaxValue; } + /// + /// Returns a list of all Blocks connected to this one. + /// public virtual List GetConnectedBlocks() { List connectedBlocks = new List(); @@ -287,6 +322,10 @@ namespace Fungus return connectedBlocks; } + /// + /// Returns the type of the previously executing command. + /// + /// The previous active command type. public virtual System.Type GetPreviousActiveCommandType() { if (previousActiveCommandIndex >= 0 && @@ -298,6 +337,9 @@ namespace Fungus return null; } + /// + /// Recalculate the indent levels for all commands in the list. + /// public virtual void UpdateIndentLevels() { int indentLevel = 0; diff --git a/Assets/Fungus/Flowchart/Scripts/Command.cs b/Assets/Fungus/Flowchart/Scripts/Command.cs index 1b6205cf..94e3ff03 100644 --- a/Assets/Fungus/Flowchart/Scripts/Command.cs +++ b/Assets/Fungus/Flowchart/Scripts/Command.cs @@ -6,21 +6,22 @@ using UnityEngine; using UnityEngine.Serialization; using System; -using System.Collections; using System.Collections.Generic; namespace Fungus -{ - +{ + /// + /// Attribute class for Fungus commands. + /// public class CommandInfoAttribute : Attribute { - /** - * Metadata atribute for the Command class. - * @param category The category to place this command in. - * @param commandName The display name of the command. - * @param helpText Help information to display in the inspector. - * @param priority If two command classes have the same name, the one with highest priority is listed. Negative priority removess the command from the list. - */ + /// + /// Metadata atribute for the Command class. + /// + /// The category to place this command in. + /// The display name of the command. + /// Help information to display in the inspector. + /// If two command classes have the same name, the one with highest priority is listed. Negative priority removess the command from the list./// public CommandInfoAttribute(string category, string commandName, string helpText, int priority = 0) { this.Category = category; @@ -35,42 +36,59 @@ namespace Fungus public int Priority { get; set; } } + /// + /// Base class for Commands. Commands can be added to Blocks to create an execution sequence. + /// public class Command : MonoBehaviour { + /// + /// Unique identifier for this command. + /// Unique for this Flowchart. + /// [FormerlySerializedAs("commandId")] [HideInInspector] [SerializeField] protected int itemId = -1; // Invalid flowchart item id - public int ItemId { get { return itemId; } set { itemId = value; } } + /// + /// Error message to display in the command inspector. + /// protected string errorMessage = ""; - public string ErrorMessage { get { return errorMessage; } } + /// + /// Indent depth of the current commands. + /// Commands are indented inside If, While, etc. sections. + /// [HideInInspector] [SerializeField] protected int indentLevel; - public int IndentLevel { get { return indentLevel; } set { indentLevel = value; } } + /// + /// Index of the command in the parent block's command list. + /// public int CommandIndex { get; set; } - /** - * Set to true by the parent block while the command is executing. - */ + /// + /// Set to true by the parent block while the command is executing. + /// public bool IsExecuting { get; set; } - /** - * Timer used to control appearance of executing icon in inspector. - */ + /// + /// Timer used to control appearance of executing icon in inspector. + /// public float ExecutingIconTimer { get; set; } - /** - * Reference to the Block object that this command belongs to. - * This reference is only populated at runtime and in the editor when the - * block is selected. - */ + /// + /// Reference to the Block object that this command belongs to. + /// This reference is only populated at runtime and in the editor when the + /// block is selected. + /// public Block ParentBlock { get; set; } + /// + /// Returns the Flowchart that this command belongs to. + /// public virtual Flowchart GetFlowchart() { Flowchart flowchart = GetComponent(); @@ -82,11 +100,17 @@ namespace Fungus return flowchart; } + /// + /// Execute the command. + /// public virtual void Execute() { OnEnter(); } + /// + /// End execution of this command and continue execution at the next command. + /// public virtual void Continue() { // This is a noop if the Block has already been stopped @@ -96,6 +120,10 @@ namespace Fungus } } + /// + /// End execution of this command and continue execution at a specific command index. + /// + /// Next command index. public virtual void Continue(int nextCommandIndex) { OnExit(); @@ -105,6 +133,9 @@ namespace Fungus } } + /// + /// Stops the parent Block executing. + /// public virtual void StopParentBlock() { OnExit(); @@ -114,99 +145,122 @@ namespace Fungus } } - /** - * Called when the parent block has been requested to stop executing, and - * this command is the currently executing command. - * Use this callback to terminate any asynchronous operations and - * cleanup state so that the command is ready to execute again later on. - */ + /// + /// Called when the parent block has been requested to stop executing, and + /// this command is the currently executing command. + /// Use this callback to terminate any asynchronous operations and + /// cleanup state so that the command is ready to execute again later on. + /// public virtual void OnStopExecuting() {} - /** - * Called when the new command is added to a block in the editor. - */ + /// + /// Called when the new command is added to a block in the editor. + /// public virtual void OnCommandAdded(Block parentBlock) {} - /** - * Called when the command is deleted from a block in the editor. - */ + /// + /// Called when the command is deleted from a block in the editor. + /// public virtual void OnCommandRemoved(Block parentBlock) {} + /// + /// Called when this command starts execution. + /// public virtual void OnEnter() {} + /// + /// Called when this command ends execution. + /// public virtual void OnExit() {} + /// + /// Called when this command is reset. This happens when the Reset command is used. + /// public virtual void OnReset() {} + /// + /// Populates a list with the Blocks that this command references. + /// public virtual void GetConnectedBlocks(ref List connectedBlocks) {} + /// + /// Returns true if this command references the variable. + /// Used to highlight variables in the variable list when a command is selected. + /// public virtual bool HasReference(Variable variable) { return false; } + /// + /// Returns the summary text to display in the command inspector. + /// public virtual string GetSummary() { return ""; } + /// + /// Returns the help text to display for this command. + /// public virtual string GetHelpText() { return ""; } - /** - * This command starts a block of commands. - */ + /// + /// Return true if this command opens a block of commands. Used for indenting commands. + /// public virtual bool OpenBlock() { return false; } - /** - * This command ends a block of commands. - */ + /// + /// Return true if this command closes a block of commands. Used for indenting commands. + /// public virtual bool CloseBlock() { return false; } - /** - * Return the color for the command background in inspector. - */ + /// + /// Return the color for the command background in inspector. + /// + /// The button color. public virtual Color GetButtonColor() { return Color.white; } - /** - * Returns true if the specified property should be displayed in the inspector. - * This is useful for hiding certain properties based on the value of another property. - */ + /// + /// Returns true if the specified property should be displayed in the inspector. + /// This is useful for hiding certain properties based on the value of another property. + /// public virtual bool IsPropertyVisible(string propertyName) { return true; } - /** - * Returns true if the specified property should be displayed as a reorderable list in the inspector. - * This only applies for array properties and has no effect for non-array properties. - */ + /// + /// Returns true if the specified property should be displayed as a reorderable list in the inspector. + /// This only applies for array properties and has no effect for non-array properties. + /// public virtual bool IsReorderableArray(string propertyName) { return false; } - /** - * Returns the localization id for the Flowchart that contains this command. - */ + /// + /// Returns the localization id for the Flowchart that contains this command. + /// public virtual string GetFlowchartLocalizationId() { // If no localization id has been set then use the Flowchart name @@ -224,7 +278,5 @@ namespace Fungus return localizationId; } - } - } \ No newline at end of file diff --git a/Assets/Fungus/Flowchart/Scripts/CommandCopyBuffer.cs b/Assets/Fungus/Flowchart/Scripts/CommandCopyBuffer.cs index 461c5c79..b6f44d6d 100644 --- a/Assets/Fungus/Flowchart/Scripts/CommandCopyBuffer.cs +++ b/Assets/Fungus/Flowchart/Scripts/CommandCopyBuffer.cs @@ -4,20 +4,21 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { - + /// + /// Temporary buffer object used when copying and pasting commands. + /// [AddComponentMenu("")] public class CommandCopyBuffer : Block { protected static CommandCopyBuffer instance; - /** - * Returns the CommandCopyBuffer singleton instance. - * Will create a CommandCopyBuffer game object if none currently exists. - */ + /// + /// Returns the CommandCopyBuffer singleton instance. + /// Will create a CommandCopyBuffer game object if none currently exists. + /// static public CommandCopyBuffer GetInstance() { if (instance == null) diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Break.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Break.cs index 4c1ac184..6675558b 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Break.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Break.cs @@ -4,12 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Force a loop to terminate immediately. + /// [CommandInfo("Flow", "Break", "Force a loop to terminate immediately.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs index d05bee84..aa1cd310 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Call.cs @@ -5,13 +5,14 @@ using UnityEngine; using UnityEngine.Serialization; -using System.Collections; using System.Collections.Generic; using System; namespace Fungus { - + /// + /// Execute another block in the same Flowchart as the command, or in a different Flowchart. + /// [CommandInfo("Flow", "Call", "Execute another block in the same Flowchart as the command, or in a different Flowchart.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/CallMethod.cs b/Assets/Fungus/Flowchart/Scripts/Commands/CallMethod.cs index 11576d8b..d5a4d6e7 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/CallMethod.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/CallMethod.cs @@ -4,13 +4,14 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { - // This command is called "Call Method" because a) it's more descriptive than Send Message and we're already have - // a Send Message command for sending messages to trigger block execution. - + /// + /// Calls a named method on a GameObject using the GameObject.SendMessage() system. + /// This command is called "Call Method" because a) it's more descriptive than Send Message and we're already have + /// a Send Message command for sending messages to trigger block execution. + /// [CommandInfo("Scripting", "Call Method", "Calls a named method on a GameObject using the GameObject.SendMessage() system.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Comment.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Comment.cs index 0d2718e1..e9c505bc 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Comment.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Comment.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Use comments to record design notes and reminders about your game. + /// [CommandInfo("", "Comment", "Use comments to record design notes and reminders about your game.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Condition.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Condition.cs index 4122418c..34c98ff9 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Condition.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Condition.cs @@ -4,8 +4,6 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; namespace Fungus { diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/DebugLog.cs b/Assets/Fungus/Flowchart/Scripts/Commands/DebugLog.cs index 99f9083c..9d4fbd48 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/DebugLog.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/DebugLog.cs @@ -4,10 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// Writes a log message to the debug console. + /// [CommandInfo("Scripting", "Debug Log", "Writes a log message to the debug console.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/DeleteSaveKey.cs b/Assets/Fungus/Flowchart/Scripts/Commands/DeleteSaveKey.cs index 31eac414..4a2342af 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/DeleteSaveKey.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/DeleteSaveKey.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; namespace Fungus { + /// + /// Deletes a saved value from permanent storage. + /// [CommandInfo("Variable", "Delete Save Key", "Deletes a saved value from permanent storage.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs index 6270b1f4..1d818732 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs @@ -5,11 +5,12 @@ using UnityEngine; using UnityEngine.Serialization; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Destroys a specified game object in the scene. + /// [CommandInfo("Scripting", "Destroy", "Destroys a specified game object in the scene.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Else.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Else.cs index 99e7354c..c1aad489 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Else.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Else.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Marks the start of a command block to be executed when the preceding If statement is False. + /// [CommandInfo("Flow", "Else", "Marks the start of a command block to be executed when the preceding If statement is False.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/ElseIf.cs b/Assets/Fungus/Flowchart/Scripts/Commands/ElseIf.cs index 61bea8b2..e42aa8dc 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/ElseIf.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/ElseIf.cs @@ -4,20 +4,18 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; namespace Fungus { - + /// + /// Marks the start of a command block to be executed when the preceding If statement is False and the test expression is true. + /// [CommandInfo("Flow", "Else If", "Marks the start of a command block to be executed when the preceding If statement is False and the test expression is true.")] [AddComponentMenu("")] public class ElseIf : If { - public override void OnEnter() { System.Type previousCommandType = ParentBlock.GetPreviousActiveCommandType(); diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/End.cs b/Assets/Fungus/Flowchart/Scripts/Commands/End.cs index 916e8032..a4f3b8c7 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/End.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/End.cs @@ -4,12 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Marks the end of a conditional block. + /// [CommandInfo("Flow", "End", "Marks the end of a conditional block.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/If.cs b/Assets/Fungus/Flowchart/Scripts/Commands/If.cs index 64081c00..62036ea7 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/If.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/If.cs @@ -4,12 +4,12 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; namespace Fungus { - + /// + /// If the test expression is true, execute the following command block. + /// [CommandInfo("Flow", "If", "If the test expression is true, execute the following command block.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/InvokeEvent.cs b/Assets/Fungus/Flowchart/Scripts/Commands/InvokeEvent.cs index 68bc778f..f6e16c24 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/InvokeEvent.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/InvokeEvent.cs @@ -4,20 +4,21 @@ */ using UnityEngine; -using System.Collections; using System; using UnityEngine.Events; namespace Fungus { + /// + /// Calls a list of component methods via the Unity Event System (as used in the Unity UI) + /// This command is more efficient than the Invoke Method command but can only pass a single parameter and doesn't support return values. + /// This command uses the UnityEvent system to call methods in script. http://docs.unity3d.com/Manual/UnityEvents.html + /// [CommandInfo("Scripting", "Invoke Event", "Calls a list of component methods via the Unity Event System (as used in the Unity UI). " + "This command is more efficient than the Invoke Method command but can only pass a single parameter and doesn't support return values.")] [AddComponentMenu("")] - - // This command uses the UnityEvent system to call methods in script. - // http://docs.unity3d.com/Manual/UnityEvents.html public class InvokeEvent : Command { [Serializable] public class BooleanEvent : UnityEvent {} diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs b/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs index 3233c953..01e33af0 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs @@ -6,7 +6,6 @@ using UnityEngine; using System.Collections; using System.Reflection; -using System.Linq; using System.Collections.Generic; using System; using UnityEngine.Events; @@ -14,10 +13,12 @@ using MarkerMetro.Unity.WinLegacy.Reflection; namespace Fungus { - + /// + /// Invokes a method of a component via reflection. Supports passing multiple parameters and storing returned values in a Fungus variable. + /// [CommandInfo("Scripting", - "Invoke Method", - "Invokes a method of a component via reflection. Supports passing multiple parameters and storing returned values in a Fungus variable.")] + "Invoke Method", + "Invokes a method of a component via reflection. Supports passing multiple parameters and storing returned values in a Fungus variable.")] public class InvokeMethod : Command { [Tooltip("GameObject containing the component method to be invoked")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Jump.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Jump.cs index 8b344b56..e71ae358 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Jump.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Jump.cs @@ -8,6 +8,9 @@ using UnityEngine.Serialization; namespace Fungus { + /// + /// Move execution to a specific Label command in the same block. + /// [CommandInfo("Flow", "Jump", "Move execution to a specific Label command in the same block")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Label.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Label.cs index c92ab861..d1a41014 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Label.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Label.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Marks a position in the command list for execution to jump to. + /// [CommandInfo("Flow", "Label", "Marks a position in the command list for execution to jump to.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs b/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs index 2b0f86d5..c4244df6 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs @@ -5,17 +5,21 @@ using UnityEngine; using UnityEngine.Serialization; -using System; -using System.Collections; namespace Fungus { + /// + /// Loads a new Unity scene and displays an optional loading image. This is useful + /// for splitting a large game across multiple scene files to reduce peak memory + /// usage. Previously loaded assets will be released before loading the scene to free up memory. + /// The scene to be loaded must be added to the scene list in Build Settings.")] + /// [CommandInfo("Flow", - "Load Scene", - "Loads a new Unity scene and displays an optional loading image. This is useful " + - "for splitting a large game across multiple scene files to reduce peak memory " + - "usage. Previously loaded assets will be released before loading the scene to free up memory." + - "The scene to be loaded must be added to the scene list in Build Settings.")] + "Load Scene", + "Loads a new Unity scene and displays an optional loading image. This is useful " + + "for splitting a large game across multiple scene files to reduce peak memory " + + "usage. Previously loaded assets will be released before loading the scene to free up memory." + + "The scene to be loaded must be added to the scene list in Build Settings.")] [AddComponentMenu("")] [ExecuteInEditMode] public class LoadScene : Command @@ -38,7 +42,7 @@ namespace Fungus return "Error: No scene name selected"; } - return _sceneName; + return _sceneName.Value; } public override Color GetButtonColor() diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/LoadVariable.cs b/Assets/Fungus/Flowchart/Scripts/Commands/LoadVariable.cs index 6b6e52e9..fe1186cd 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/LoadVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/LoadVariable.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; namespace Fungus { + /// + /// Loads a saved value and stores it in a Boolean, Integer, Float or String variable. If the key is not found then the variable is not modified. + /// [CommandInfo("Variable", "Load Variable", "Loads a saved value and stores it in a Boolean, Integer, Float or String variable. If the key is not found then the variable is not modified.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs b/Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs index f54ece81..2a778670 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs @@ -4,12 +4,13 @@ */ using UnityEngine; -using System.Collections; using Fungus; namespace Fungus { - + /// + /// Opens the specified URL in the browser. + /// [CommandInfo("Scripting", "Open URL", "Opens the specified URL in the browser.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Quit.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Quit.cs index 41993a16..3ca16ed2 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Quit.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Quit.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; namespace Fungus { + /// + /// Quits the application. Does not work in Editor or Webplayer builds. Shouldn't generally be used on iOS. + /// [CommandInfo("Flow", "Quit", "Quits the application. Does not work in Editor or Webplayer builds. Shouldn't generally be used on iOS.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/RandomFloat.cs b/Assets/Fungus/Flowchart/Scripts/Commands/RandomFloat.cs index cf16f8bd..48a68084 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/RandomFloat.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/RandomFloat.cs @@ -4,10 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// Sets an float variable to a random value in the defined range. + /// [CommandInfo("Variable", "Random Float", "Sets an float variable to a random value in the defined range.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/RandomInteger.cs b/Assets/Fungus/Flowchart/Scripts/Commands/RandomInteger.cs index 4a077ac5..8cfc5489 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/RandomInteger.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/RandomInteger.cs @@ -4,10 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// Sets an integer variable to a random value in the defined range. + /// [CommandInfo("Variable", "Random Integer", "Sets an integer variable to a random value in the defined range.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/ReadTextFile.cs b/Assets/Fungus/Flowchart/Scripts/Commands/ReadTextFile.cs index 0c9a8948..742d6421 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/ReadTextFile.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/ReadTextFile.cs @@ -4,12 +4,13 @@ */ using UnityEngine; -using System.Collections; using Fungus; namespace Fungus { - + /// + /// Reads in a text file and stores the contents in a string variable. + /// [CommandInfo("Variable", "Read Text File", "Reads in a text file and stores the contents in a string variable")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Reset.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Reset.cs index 32be1d32..6b9d4ea9 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Reset.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Reset.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Resets the state of all commands and variables in the Flowchart. + /// [CommandInfo("Variable", "Reset", "Resets the state of all commands and variables in the Flowchart.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SaveVariable.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SaveVariable.cs index 7f9fd22d..cfedd83a 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SaveVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SaveVariable.cs @@ -4,11 +4,14 @@ */ using UnityEngine; -using System; -using System.Collections; namespace Fungus { + /// + /// Save an Boolean, Integer, Float or String variable to persistent storage using a string key. + /// The value can be loaded again later using the Load Variable command. You can also + /// use the Set Save Profile command to manage separate save profiles for multiple players. + /// [CommandInfo("Variable", "Save Variable", "Save an Boolean, Integer, Float or String variable to persistent storage using a string key. " + diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs index bc641c8c..c122497a 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs @@ -5,10 +5,12 @@ using UnityEngine; using UnityEngine.Serialization; -using System.Collections; namespace Fungus { + /// + /// Sends a message to either the owner Flowchart or all Flowcharts in the scene. Blocks can listen for this message using a Message Received event handler. + /// [CommandInfo("Flow", "Send Message", "Sends a message to either the owner Flowchart or all Flowcharts in the scene. Blocks can listen for this message using a Message Received event handler.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs index 45cabdc4..c675f937 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs @@ -5,11 +5,12 @@ using UnityEngine; using UnityEngine.Serialization; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Sets a game object in the scene to be active / inactive. + /// [CommandInfo("Scripting", "Set Active", "Sets a game object in the scene to be active / inactive.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SetSaveProfile.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SetSaveProfile.cs index 5feb81e3..16351d5f 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SetSaveProfile.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SetSaveProfile.cs @@ -9,6 +9,9 @@ using System.Collections; namespace Fungus { + /// + /// Sets the active profile that the Save Variable and Load Variable commands will use. This is useful to crete multiple player save games. Once set, the profile applies across all Flowcharts and will also persist across scene loads. + /// [CommandInfo("Variable", "Set Save Profile", "Sets the active profile that the Save Variable and Load Variable commands will use. This is useful to crete multiple player save games. Once set, the profile applies across all Flowcharts and will also persist across scene loads.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SetVariable.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SetVariable.cs index 1979a133..89705caa 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SetVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SetVariable.cs @@ -4,10 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// Sets a Boolean, Integer, Float or String variable to a new value using a simple arithmetic operation. The value can be a constant or reference another variable of the same type. + /// [CommandInfo("Variable", "Set Variable", "Sets a Boolean, Integer, Float or String variable to a new value using a simple arithmetic operation. The value can be a constant or reference another variable of the same type.")] @@ -33,7 +35,6 @@ namespace Fungus [Tooltip("The type of math operation to be performed")] [SerializeField] protected SetOperator setOperator; - public SetOperator _SetOperator { get { return setOperator; } } [Tooltip("Boolean value to set with")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs index 537399e8..f9953127 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs @@ -5,13 +5,12 @@ using UnityEngine; using UnityEngine.Serialization; -using System.Collections; namespace Fungus { - // This command is called "Call Method" because a) it's more descriptive than Send Message and we're already have - // a Send Message command for sending messages to trigger block execution. - + /// + /// Spawns a new object based on a reference to a scene or prefab game object. + /// [CommandInfo("Scripting", "Spawn Object", "Spawns a new object based on a reference to a scene or prefab game object.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Stop.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Stop.cs index cde5d8d2..3ca29a78 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Stop.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Stop.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Stop executing the Block that contains this command. + /// [CommandInfo("Flow", "Stop", "Stop executing the Block that contains this command.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/StopBlock.cs b/Assets/Fungus/Flowchart/Scripts/Commands/StopBlock.cs index 7f4c3aa8..e044cc46 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/StopBlock.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/StopBlock.cs @@ -4,11 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { - + /// + /// Stops executing the named Block. + /// [CommandInfo("Flow", "Stop Block", "Stops executing the named Block")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs b/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs index 067363c8..d948cbb3 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs @@ -4,11 +4,13 @@ */ using UnityEngine; -using System.Collections; using System.Collections.Generic; namespace Fungus { + /// + /// Stops execution of all Blocks in a Flowchart. + /// [CommandInfo("Flow", "Stop Flowchart", "Stops execution of all Blocks in a Flowchart")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs index 960569b8..7eddf09c 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs @@ -5,11 +5,12 @@ using UnityEngine; using UnityEngine.Serialization; -using System; -using System.Collections; namespace Fungus { + /// + /// Waits for period of time before executing the next command in the block. + /// [CommandInfo("Flow", "Wait", "Waits for period of time before executing the next command in the block.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/While.cs b/Assets/Fungus/Flowchart/Scripts/Commands/While.cs index 9ca478e6..4a1a126b 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/While.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/While.cs @@ -4,12 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Continuously loop through a block of commands while the condition is true. Use the Break command to force the loop to terminate immediately. + /// [CommandInfo("Flow", "While", "Continuously loop through a block of commands while the condition is true. Use the Break command to force the loop to terminate immediately.")] diff --git a/Assets/Fungus/Flowchart/Scripts/EventHandler.cs b/Assets/Fungus/Flowchart/Scripts/EventHandler.cs index dc406283..c9276aed 100644 --- a/Assets/Fungus/Flowchart/Scripts/EventHandler.cs +++ b/Assets/Fungus/Flowchart/Scripts/EventHandler.cs @@ -6,12 +6,12 @@ using UnityEngine; using UnityEngine.Serialization; using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { - + /// + /// Attribute class for Fungus event handlers. + /// public class EventHandlerInfoAttribute : Attribute { public EventHandlerInfoAttribute(string category, string eventHandlerName, string helpText) @@ -26,28 +26,31 @@ namespace Fungus public string HelpText { get; set; } } - /** - * A Block may have an associated Event Handler which starts executing commands when - * a specific event occurs. - * To create a custom Event Handler, simply subclass EventHandler and call the ExecuteBlock() method - * when the event occurs. - * Add an EventHandlerInfo attibute and your new EventHandler class will automatically appear in the - * 'Execute On Event' dropdown menu when a block is selected. - */ + /// + /// A Block may have an associated Event Handler which starts executing commands when + /// a specific event occurs. + /// To create a custom Event Handler, simply subclass EventHandler and call the ExecuteBlock() method + /// when the event occurs. + /// Add an EventHandlerInfo attibute and your new EventHandler class will automatically appear in the + /// 'Execute On Event' dropdown menu when a block is selected. + /// [RequireComponent(typeof(Block))] [RequireComponent(typeof(Flowchart))] [AddComponentMenu("")] public class EventHandler : MonoBehaviour { + /// + /// Returns the parent Block which owns this Event Handler. + /// + /// The parent block. [HideInInspector] [FormerlySerializedAs("parentSequence")] [SerializeField] protected Block parentBlock; - public Block ParentBlock { get { return parentBlock; } set { parentBlock = value; } } - /** - * The Event Handler should call this method when the event is detected. - */ + /// + /// The Event Handler should call this method when the event is detected. + /// public virtual bool ExecuteBlock() { if (parentBlock == null) @@ -71,9 +74,9 @@ namespace Fungus return flowchart.ExecuteBlock(parentBlock); } - /** - * Returns a custom summary for the event handler. - */ + /// + /// Returns custom summary text for the event handler. + /// public virtual string GetSummary() { return ""; diff --git a/Assets/Fungus/Flowchart/Scripts/EventHandlers/FlowchartEnabled.cs b/Assets/Fungus/Flowchart/Scripts/EventHandlers/FlowchartEnabled.cs index 5467a1cf..2f9267c5 100644 --- a/Assets/Fungus/Flowchart/Scripts/EventHandlers/FlowchartEnabled.cs +++ b/Assets/Fungus/Flowchart/Scripts/EventHandlers/FlowchartEnabled.cs @@ -4,12 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// The block will execute when the Flowchart game object is enabled. + /// [EventHandlerInfo("", "Flowchart Enabled", "The block will execute when the Flowchart game object is enabled.")] diff --git a/Assets/Fungus/Flowchart/Scripts/EventHandlers/GameStarted.cs b/Assets/Fungus/Flowchart/Scripts/EventHandlers/GameStarted.cs index cc614398..f1f4bc38 100644 --- a/Assets/Fungus/Flowchart/Scripts/EventHandlers/GameStarted.cs +++ b/Assets/Fungus/Flowchart/Scripts/EventHandlers/GameStarted.cs @@ -4,12 +4,12 @@ */ using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// The block will execute when the game starts playing. + /// [EventHandlerInfo("", "Game Started", "The block will execute when the game starts playing.")] diff --git a/Assets/Fungus/Flowchart/Scripts/EventHandlers/KeyPressed.cs b/Assets/Fungus/Flowchart/Scripts/EventHandlers/KeyPressed.cs index 1f7788c1..c0808cb9 100644 --- a/Assets/Fungus/Flowchart/Scripts/EventHandlers/KeyPressed.cs +++ b/Assets/Fungus/Flowchart/Scripts/EventHandlers/KeyPressed.cs @@ -4,10 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// The block will execute when a key press event occurs. + /// [EventHandlerInfo("Input", "Key Pressed", "The block will execute when a key press event occurs.")] diff --git a/Assets/Fungus/Flowchart/Scripts/EventHandlers/MessageReceived.cs b/Assets/Fungus/Flowchart/Scripts/EventHandlers/MessageReceived.cs index 95885b26..0061822e 100644 --- a/Assets/Fungus/Flowchart/Scripts/EventHandlers/MessageReceived.cs +++ b/Assets/Fungus/Flowchart/Scripts/EventHandlers/MessageReceived.cs @@ -4,10 +4,12 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// The block will execute when the specified message is received from a Send Message command. + /// [EventHandlerInfo("", "Message Received", "The block will execute when the specified message is received from a Send Message command.")] diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index b401398d..81c44aed 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -14,207 +14,194 @@ using System.Text.RegularExpressions; namespace Fungus { - /** - * Interface for Flowchart components which can be updated when the - * scene loads in the editor. This is used to maintain backwards - * compatibility with earlier versions of Fungus. - */ + /// + /// Interface for Flowchart components which can be updated when the + /// scene loads in the editor. This is used to maintain backwards + /// compatibility with earlier versions of Fungus. + /// interface IUpdateable { void UpdateToVersion(int oldVersion, int newVersion); } - /** - * Visual scripting controller for the Flowchart programming language. - * Flowchart objects may be edited visually using the Flowchart editor window. - */ + /// + /// Visual scripting controller for the Flowchart programming language. + /// Flowchart objects may be edited visually using the Flowchart editor window. + /// [ExecuteInEditMode] public class Flowchart : MonoBehaviour, StringSubstituter.ISubstitutionHandler { - /** - * The current version of the Flowchart. Used for updating components. - */ + /// + /// The current version of the Flowchart. Used for updating components. + /// public const int CURRENT_VERSION = 1; - /** - * The name of the initial block in a new flowchart. - */ + /// + /// The name of the initial block in a new flowchart. + /// public const string DEFAULT_BLOCK_NAME = "New Block"; - /** - * Variable to track flowchart's version so components can update to new versions. - */ + /// + /// Variable to track flowchart's version so components can update to new versions. + /// [HideInInspector] [SerializeField] protected int version = 0; // Default to 0 to always trigger an update for older versions of Fungus. - public int Version { set { version = value; } } - /** - * Scroll position of Flowchart editor window. - */ + /// + /// Scroll position of Flowchart editor window. + /// [HideInInspector] [SerializeField] protected Vector2 scrollPos; - public Vector2 ScrollPos { get { return scrollPos; } set { scrollPos = value; } } - /** - * Scroll position of Flowchart variables window. - */ + /// + /// Scroll position of Flowchart variables window. + /// [HideInInspector] [SerializeField] protected Vector2 variablesScrollPos; - public Vector2 VariablesScrollPos { get { return variablesScrollPos; } set { variablesScrollPos = value; } } - /** - * Show the variables pane. - */ + /// + /// Show the variables pane. + /// [HideInInspector] [SerializeField] protected bool variablesExpanded = true; - public bool VariablesExpanded { get { return variablesExpanded; } set { variablesExpanded = value; } } - /** - * Height of command block view in inspector. - */ + /// + /// Height of command block view in inspector. + /// [HideInInspector] [SerializeField] protected float blockViewHeight = 400; - public float BlockViewHeight { get { return blockViewHeight; } set { blockViewHeight = value; } } - /** - * Zoom level of Flowchart editor window - */ + /// + /// Zoom level of Flowchart editor window. + /// [HideInInspector] [SerializeField] protected float zoom = 1f; - public float Zoom { get { return zoom; } set { zoom = value; } } - /** - * Scrollable area for Flowchart editor window. - */ + /// + /// Scrollable area for Flowchart editor window. + /// [HideInInspector] [SerializeField] protected Rect scrollViewRect; - public Rect ScrollViewRect { get { return scrollViewRect; } set { scrollViewRect = value; } } - /** - * Currently selected block in the Flowchart editor. - */ + /// + /// Currently selected block in the Flowchart editor. + /// [HideInInspector] [FormerlySerializedAs("selectedSequence")] [SerializeField] protected Block selectedBlock; - public Block SelectedBlock { get { return selectedBlock; } set { selectedBlock = value; } } - - /** - * Currently selected command in the Flowchart editor. - */ + + /// + /// Currently selected command in the Flowchart editor. + /// [HideInInspector] [SerializeField] protected List selectedCommands = new List(); - public List SelectedCommands { get { return selectedCommands; } } - /** - * The list of variables that can be accessed by the Flowchart. - */ + /// + /// The list of variables that can be accessed by the Flowchart. + /// [HideInInspector] [SerializeField] protected List variables = new List(); - public List Variables { get { return variables; } } + /// + /// Description text displayed in the Flowchart editor window + /// [TextArea(3, 5)] [Tooltip("Description text displayed in the Flowchart editor window")] [SerializeField] protected string description = ""; - public string Description { get { return description; } } - /** - * Slow down execution in the editor to make it easier to visualise program flow. - */ + /// + /// Slow down execution in the editor to make it easier to visualise program flow. + /// [Range(0f, 5f)] [Tooltip("Adds a pause after each execution step to make it easier to visualise program flow. Editor only, has no effect in platform builds.")] [SerializeField] protected float stepPause = 0f; - public float StepPause { get { return stepPause; } } - /** - * Use command color when displaying the command list in the inspector. - */ + /// + /// Use command color when displaying the command list in the inspector. + /// [Tooltip("Use command color when displaying the command list in the Fungus Editor window")] [SerializeField] protected bool colorCommands = true; - public bool ColorCommands { get { return colorCommands; } } - /** - * Hides the Flowchart block and command components in the inspector. - * Deselect to inspect the block and command components that make up the Flowchart. - */ - [Tooltip("Hides the Flowchart block and command components in the inspector")] + /// + /// Hides the Flowchart block and command components in the inspector. + /// Deselect to inspect the block and command components that make up the Flowchart. + /// + [Tooltip("Hides the Flowchart block and command components in the inspector. Deselect to inspect the block and command components that make up the Flowchart.")] [SerializeField] protected bool hideComponents = true; - /** - * Saves the selected block and commands when saving the scene. - * Helps avoid version control conflicts if you've only changed the active selection. - */ - [Tooltip("Saves the selected block and commands when saving the scene.")] + /// + /// Saves the selected block and commands when saving the scene. Helps avoid version control conflicts if you've only changed the active selection. + /// + [Tooltip("Saves the selected block and commands when saving the scene. Helps avoid version control conflicts if you've only changed the active selection.")] [SerializeField] protected bool saveSelection = true; - public bool SaveSelection { get { return saveSelection; } } - /** - * Unique identifier for identifying this flowchart in localized string keys. - */ + /// + /// Unique identifier for identifying this flowchart in localized string keys. + /// [Tooltip("Unique identifier for this flowchart in localized string keys. If no id is specified then the name of the Flowchart object will be used.")] [SerializeField] protected string localizationId = ""; - public string LocalizationId { get { return localizationId; } } - /** - * Display line numbers in the command list in the Block inspector. - */ + /// + /// Display line numbers in the command list in the Block inspector. + /// [Tooltip("Display line numbers in the command list in the Block inspector.")] [SerializeField] protected bool showLineNumbers = false; - public bool ShowLineNumbers { get { return showLineNumbers; } } - /** - * List of commands to hide in the Add Command menu. Use this to restrict the set of commands available when editing a Flowchart. - */ + /// + /// List of commands to hide in the Add Command menu. Use this to restrict the set of commands available when editing a Flowchart. + /// [Tooltip("List of commands to hide in the Add Command menu. Use this to restrict the set of commands available when editing a Flowchart.")] [SerializeField] protected List hideCommands = new List(); + /// + /// Lua Environment to be used by default for all Execute Lua commands in this Flowchart. + /// [Tooltip("Lua Environment to be used by default for all Execute Lua commands in this Flowchart")] [SerializeField] protected LuaEnvironment luaEnvironment; - public LuaEnvironment _LuaEnvironment { get { return luaEnvironment; } } - /** - * The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing. - */ + /// + /// The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing. + /// [Tooltip("The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing.")] [SerializeField] protected string luaBindingName = "flowchart"; - public string LuaBindingName { get { return luaBindingName; } } - /** - * Position in the center of all blocks in the flowchart. - */ + /// + /// Position in the center of all blocks in the flowchart. + /// public Vector2 CenterPosition { set; get; } - /** - * Cached list of flowchart objects in the scene for fast lookup - */ + /// + /// Cached list of flowchart objects in the scene for fast lookup. + /// public static List cachedFlowcharts = new List(); protected static bool eventSystemPresent; protected StringSubstituter stringSubstituer; - /** - * Returns the next id to assign to a new flowchart item. - * Item ids increase monotically so they are guaranteed to - * be unique within a Flowchart. - */ + /// + /// Returns the next id to assign to a new flowchart item. + /// Item ids increase monotically so they are guaranteed to + /// be unique within a Flowchart. + /// public int NextItemId() { int maxId = -1; @@ -410,9 +397,9 @@ namespace Fungus return block; } - /** - * Create a new block node which you can then add commands to. - */ + /// + /// Create a new block node which you can then add commands to. + /// public virtual Block CreateBlock(Vector2 position) { Block b = CreateBlockComponent(gameObject); @@ -423,9 +410,9 @@ namespace Fungus return b; } - /** - * Returns the named Block in the flowchart, or null if not found. - */ + /// + /// Returns the named Block in the flowchart, or null if not found. + /// public virtual Block FindBlock(string blockName) { Block [] blocks = GetComponents(); @@ -440,11 +427,9 @@ namespace Fungus return null; } - /** - * Execute a child block in the Flowchart. - * You can use this method in a UI event. e.g. to handle a button click. - * Returns true if the Block started execution. - */ + /// + /// Execute a child block in the Flowchart. + /// You can use this method in a UI event. e.g. to handle a button click. public virtual void ExecuteBlock(string blockName) { Block block = null; @@ -469,12 +454,12 @@ namespace Fungus } } - /** - * Execute a child block in the flowchart. - * The block must be in an idle state to be executed. - * This version provides extra options to control how the block is executed. - * Returns true if the Block started execution. - */ + /// + /// Execute a child block in the flowchart. + /// The block must be in an idle state to be executed. + /// This version provides extra options to control how the block is executed. + /// Returns true if the Block started execution. + /// public virtual bool ExecuteBlock(Block block, int commandIndex = 0, Action onComplete = null) { if (block == null) @@ -501,9 +486,9 @@ namespace Fungus return true; } - /** - * Stop all executing Blocks in this Flowchart. - */ + /// + /// Stop all executing Blocks in this Flowchart. + /// public virtual void StopAllBlocks() { Block [] blocks = GetComponents(); @@ -516,10 +501,10 @@ namespace Fungus } } - /** - * Sends a message to this Flowchart only. - * Any block with a matching MessageReceived event handler will start executing. - */ + /// + /// Sends a message to this Flowchart only. + /// Any block with a matching MessageReceived event handler will start executing. + /// public virtual void SendFungusMessage(string messageName) { MessageReceived[] eventHandlers = GetComponents(); @@ -529,10 +514,10 @@ namespace Fungus } } - /** - * Sends a message to all Flowchart objects in the current scene. - * Any block with a matching MessageReceived event handler will start executing. - */ + /// + /// Sends a message to all Flowchart objects in the current scene. + /// Any block with a matching MessageReceived event handler will start executing. + /// public static void BroadcastFungusMessage(string messageName) { MessageReceived[] eventHandlers = UnityEngine.Object.FindObjectsOfType(); @@ -542,9 +527,9 @@ 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 virtual string GetUniqueVariableKey(string originalKey, Variable ignoreVariable = null) { int suffix = 0; @@ -591,9 +576,9 @@ namespace Fungus } } - /** - * Returns a new Block key that is guaranteed not to clash with any existing Block in the Flowchart. - */ + /// + /// Returns a new Block key that is guaranteed not to clash with any existing Block in the Flowchart. + /// public virtual string GetUniqueBlockKey(string originalKey, Block ignoreBlock = null) { int suffix = 0; @@ -634,9 +619,9 @@ namespace Fungus } } - /** - * Returns a new Label key that is guaranteed not to clash with any existing Label in the Block. - */ + /// + /// Returns a new Label key that is guaranteed not to clash with any existing Label in the Block. + /// public virtual string GetUniqueLabelKey(string originalKey, Label ignoreLabel) { int suffix = 0; @@ -677,14 +662,14 @@ namespace Fungus } } } - - /** - * Returns the variable with the specified key, or null if the key is not found. - * You will need to cast the returned variable to the correct sub-type. - * You can then access the variable's value using the Value property. e.g. - * BooleanVariable boolVar = flowchart.GetVariable("MyBool") as BooleanVariable; - * boolVar.Value = false; - */ + + /// + /// Returns the variable with the specified key, or null if the key is not found. + /// You will need to cast the returned variable to the correct sub-type. + /// You can then access the variable's value using the Value property. e.g. + /// BooleanVariable boolVar = flowchart.GetVariable("MyBool") as BooleanVariable; + /// boolVar.Value = false; + /// public Variable GetVariable(string key) { foreach (Variable variable in variables) @@ -698,12 +683,12 @@ namespace Fungus return null; } - /** - * Returns the variable with the specified key, or null if the key is not found. - * You can then access the variable's value using the Value property. e.g. - * BooleanVariable boolVar = flowchart.GetVariable("MyBool"); - * boolVar.Value = false; - */ + /// + /// Returns the variable with the specified key, or null if the key is not found. + /// You can then access the variable's value using the Value property. e.g. + /// BooleanVariable boolVar = flowchart.GetVariable("MyBool"); + /// boolVar.Value = false; + /// public T GetVariable(string key) where T : Variable { foreach (Variable variable in variables) @@ -718,10 +703,10 @@ namespace Fungus return null; } - /** - * Register a new variable with the Flowchart at runtime. - * The variable should be added as a component on the Flowchart game object. - */ + /// + /// Register a new variable with the Flowchart at runtime. + /// The variable should be added as a component on the Flowchart game object. + /// public void SetVariable(string key, T newvariable) where T : Variable { foreach (Variable v in variables) @@ -740,9 +725,9 @@ namespace Fungus Debug.LogWarning("Variable " + key + " not found."); } - /** - * Gets a list of all variables with public scope in this Flowchart. - */ + /// + /// Gets a list of all variables with public scope in this Flowchart. + /// public virtual List GetPublicVariables() { List publicVariables = new List(); @@ -757,10 +742,10 @@ namespace Fungus return publicVariables; } - /** - * Gets the value of a boolean variable. - * Returns false if the variable key does not exist. - */ + /// + /// Gets the value of a boolean variable. + /// Returns false if the variable key does not exist. + /// public virtual bool GetBooleanVariable(string key) { BooleanVariable variable = GetVariable(key); @@ -775,10 +760,10 @@ namespace Fungus } } - /** - * Sets the value of a boolean variable. - * The variable must already be added to the list of variables for this Flowchart. - */ + /// + /// Sets the value of a boolean variable. + /// The variable must already be added to the list of variables for this Flowchart. + /// public virtual void SetBooleanVariable(string key, bool value) { BooleanVariable variable = GetVariable(key); @@ -788,10 +773,10 @@ namespace Fungus } } - /** - * Gets the value of an integer variable. - * Returns 0 if the variable key does not exist. - */ + /// + /// Gets the value of an integer variable. + /// Returns 0 if the variable key does not exist. + /// public virtual int GetIntegerVariable(string key) { IntegerVariable variable = GetVariable(key); @@ -806,10 +791,10 @@ namespace Fungus } } - /** - * Sets the value of an integer variable. - * The variable must already be added to the list of variables for this Flowchart. - */ + /// + /// Sets the value of an integer variable. + /// The variable must already be added to the list of variables for this Flowchart. + /// public virtual void SetIntegerVariable(string key, int value) { IntegerVariable variable = GetVariable(key); @@ -819,10 +804,10 @@ namespace Fungus } } - /** - * Gets the value of a float variable. - * Returns 0 if the variable key does not exist. - */ + /// + /// Gets the value of a float variable. + /// Returns 0 if the variable key does not exist. + /// public virtual float GetFloatVariable(string key) { FloatVariable variable = GetVariable(key); @@ -837,10 +822,10 @@ namespace Fungus } } - /** - * Sets the value of a float variable. - * The variable must already be added to the list of variables for this Flowchart. - */ + /// + /// Sets the value of a float variable. + /// The variable must already be added to the list of variables for this Flowchart. + /// public virtual void SetFloatVariable(string key, float value) { FloatVariable variable = GetVariable(key); @@ -850,10 +835,10 @@ namespace Fungus } } - /** - * Gets the value of a string variable. - * Returns the empty string if the variable key does not exist. - */ + /// + /// Gets the value of a string variable. + /// Returns the empty string if the variable key does not exist. + /// public virtual string GetStringVariable(string key) { StringVariable variable = GetVariable(key); @@ -868,10 +853,10 @@ namespace Fungus } } - /** - * Sets the value of a string variable. - * The variable must already be added to the list of variables for this Flowchart. - */ + /// + /// Sets the value of a string variable. + /// The variable must already be added to the list of variables for this Flowchart. + /// public virtual void SetStringVariable(string key, string value) { StringVariable variable = GetVariable(key); @@ -881,9 +866,9 @@ namespace Fungus } } - /** - * Set the block objects to be hidden or visible depending on the hideComponents property. - */ + /// + /// Set the block objects to be hidden or visible depending on the hideComponents property. + /// public virtual void UpdateHideFlags() { if (hideComponents) @@ -927,11 +912,17 @@ namespace Fungus } + /// + /// Clears the list of selected commands. + /// public virtual void ClearSelectedCommands() { selectedCommands.Clear(); } - + + /// + /// Adds a command to the list of selected commands. + /// public virtual void AddSelectedCommand(Command command) { if (!selectedCommands.Contains(command)) @@ -940,6 +931,9 @@ namespace Fungus } } + /// + /// Reset the commands and variables in the Flowchart. + /// public virtual void Reset(bool resetCommands, bool resetVariables) { if (resetCommands) @@ -960,9 +954,9 @@ namespace Fungus } } - /** - * Override this in a Flowchart subclass to filter which commands are shown in the Add Command list. - */ + /// + /// Override this in a Flowchart subclass to filter which commands are shown in the Add Command list. + /// public virtual bool IsCommandSupported(CommandInfoAttribute commandInfo) { foreach (string key in hideCommands) @@ -978,9 +972,9 @@ namespace Fungus return true; } - /** - * Returns true if there are any executing blocks in this Flowchart. - */ + /// + /// Returns true if there are any executing blocks in this Flowchart. + /// public virtual bool HasExecutingBlocks() { Block[] blocks = GetComponents(); @@ -994,9 +988,9 @@ namespace Fungus return false; } - /** - * Returns a list of all executing blocks in this Flowchart. - */ + /// + /// Returns a list of all executing blocks in this Flowchart. + /// public virtual List GetExecutingBlocks() { List executingBlocks = new List(); @@ -1013,11 +1007,11 @@ namespace Fungus return executingBlocks; } - /** - * Implementation of StringSubstituter.ISubstitutionHandler which matches any public variable in the Flowchart. - * To perform full variable substitution with all substitution handlers in the scene, you should - * use the SubstituteVariables() method instead. - */ + /// + /// Implementation of StringSubstituter.ISubstitutionHandler which matches any public variable in the Flowchart. + /// To perform full variable substitution with all substitution handlers in the scene, you should + /// use the SubstituteVariables() method instead. + /// [MoonSharp.Interpreter.MoonSharpHidden] public virtual bool SubstituteStrings(StringBuilder input) { @@ -1052,12 +1046,12 @@ namespace Fungus return modified; } - /** - * Substitute variables in the input text with the format {$VarName} - * This will first match with private variables in this Flowchart, and then - * with public variables in all Flowcharts in the scene (and any component - * in the scene that implements StringSubstituter.ISubstitutionHandler). - */ + /// + /// Substitute variables in the input text with the format {$VarName} + /// This will first match with private variables in this Flowchart, and then + /// with public variables in all Flowcharts in the scene (and any component + /// in the scene that implements StringSubstituter.ISubstitutionHandler). + /// public virtual string SubstituteVariables(string input) { if (stringSubstituer == null) diff --git a/Assets/Fungus/Flowchart/Scripts/FungusState.cs b/Assets/Fungus/Flowchart/Scripts/FungusState.cs index db7e07d9..44838c58 100644 --- a/Assets/Fungus/Flowchart/Scripts/FungusState.cs +++ b/Assets/Fungus/Flowchart/Scripts/FungusState.cs @@ -4,18 +4,17 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { - - // Used by the Flowchart window to serialize the currently active Flowchart object - // so that the same Flowchart can be displayed while editing & playing. + /// + /// Used by the Flowchart window to serialize the currently active Flowchart object + /// so that the same Flowchart can be displayed while editing & playing. + /// [AddComponentMenu("")] public class FungusState : MonoBehaviour { [SerializeField] protected Flowchart selectedFlowchart; - public Flowchart SelectedFlowchart { get { return selectedFlowchart; } set { selectedFlowchart = value; } } } diff --git a/Assets/Fungus/Flowchart/Scripts/Node.cs b/Assets/Fungus/Flowchart/Scripts/Node.cs index 40b74b85..0608b930 100644 --- a/Assets/Fungus/Flowchart/Scripts/Node.cs +++ b/Assets/Fungus/Flowchart/Scripts/Node.cs @@ -4,17 +4,16 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { - + /// + /// Base class for Flowchart nodes. + /// [AddComponentMenu("")] public class Node : MonoBehaviour { [SerializeField] protected Rect nodeRect = new Rect(0, 0, 120, 30); - public Rect _NodeRect { get { return nodeRect; } set { nodeRect = value; } } } - } \ No newline at end of file diff --git a/Assets/Fungus/Flowchart/Scripts/SceneLoader.cs b/Assets/Fungus/Flowchart/Scripts/SceneLoader.cs index c5fbe60d..ac3ac692 100644 --- a/Assets/Fungus/Flowchart/Scripts/SceneLoader.cs +++ b/Assets/Fungus/Flowchart/Scripts/SceneLoader.cs @@ -9,27 +9,26 @@ using UnityEngine.SceneManagement; #endif using System.Collections; -using System; namespace Fungus { - /** - * Helper component for loading a new scene. - * A fullscreen loading image is displayed while loading the new scene. - * All Rooms are destroyed and unused assets are released from memory before loading the new scene to minimize memory footprint. - * For streaming Web Player builds, the loading image will be displayed until the requested level has finished downloading. - */ + /// + /// Helper component for loading a new scene. + /// A fullscreen loading image is displayed while loading the new scene. + /// All Rooms are destroyed and unused assets are released from memory before loading the new scene to minimize memory footprint. + /// For streaming Web Player builds, the loading image will be displayed until the requested level has finished downloading. + /// public class SceneLoader : MonoBehaviour { protected Texture2D loadingTexture; protected string sceneToLoad; protected bool displayedImage; - /** - * Asynchronously load a new scene. - * @param _sceneToLoad The name of the scene to load. Scenes must be added in project build settings. - * @param _loadingTexture Loading image to display while loading the new scene. - */ + /// + /// Asynchronously load a new scene. + /// + /// The name of the scene to load. Scenes must be added in project build settings. + /// Loading image to display while loading the new scene. static public void LoadScene(string _sceneToLoad, Texture2D _loadingTexture) { // Unity does not provide a way to check if the named scene actually exists in the project. diff --git a/Assets/Fungus/Flowchart/Scripts/StringFormatter.cs b/Assets/Fungus/Flowchart/Scripts/StringFormatter.cs index bd35dd35..24d9b93a 100644 --- a/Assets/Fungus/Flowchart/Scripts/StringFormatter.cs +++ b/Assets/Fungus/Flowchart/Scripts/StringFormatter.cs @@ -3,14 +3,14 @@ * It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) */ -using UnityEngine; -using System.IO; -using System.Collections; using System.Text; using System; namespace Fungus { + /// + /// Misc string formatting functions. + /// public class StringFormatter { public static string[] FormatEnumNames(Enum e, string firstLabel) diff --git a/Assets/Fungus/Flowchart/Scripts/Variable.cs b/Assets/Fungus/Flowchart/Scripts/Variable.cs index 56886bef..ff1f6487 100644 --- a/Assets/Fungus/Flowchart/Scripts/Variable.cs +++ b/Assets/Fungus/Flowchart/Scripts/Variable.cs @@ -5,17 +5,21 @@ using UnityEngine; using System; -using System.Collections; -using System.Collections.Generic; namespace Fungus { + /// + /// Scope types for Variables. + /// public enum VariableScope { Private, Public } + /// + /// Attribute class for variables. + /// public class VariableInfoAttribute : Attribute { public VariableInfoAttribute(string category, string variableType, int order = 0) @@ -30,6 +34,9 @@ namespace Fungus public int Order { get; set; } } + /// + /// Attribute class for variable properties. + /// public class VariablePropertyAttribute : PropertyAttribute { public VariablePropertyAttribute (params System.Type[] variableTypes) @@ -48,24 +55,27 @@ namespace Fungus public System.Type[] VariableTypes { get; set; } } + /// + /// Abstract base class for variables. + /// [RequireComponent(typeof(Flowchart))] public abstract class Variable : MonoBehaviour { [SerializeField] protected VariableScope scope; - public VariableScope Scope { get { return scope; } } [SerializeField] protected string key = ""; - public string Key { get { return key; } set { key = value; } } public abstract void OnReset(); } + /// + /// Generic concrete base class for variables. + /// public abstract class VariableBase : Variable { [SerializeField] protected T value; - public T Value { get { return this.value; } set { this.value = value; } } protected T startValue; diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs index 6393c7a2..ea77d8b1 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs @@ -4,16 +4,21 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// Animator variable type. + /// [VariableInfo("Other", "Animator")] [AddComponentMenu("")] [System.Serializable] public class AnimatorVariable : VariableBase {} + /// + /// Container for an Animator variable reference or constant value. + /// [System.Serializable] public struct AnimatorData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs index 138af1ec..f6b2868f 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs @@ -4,16 +4,21 @@ */ using UnityEngine; -using System.Collections; namespace Fungus { + /// + /// AudioSource variable type. + /// [VariableInfo("Other", "AudioSource")] [AddComponentMenu("")] [System.Serializable] public class AudioSourceVariable : VariableBase {} + /// + /// Container for an AudioSource variable reference or constant value. + /// [System.Serializable] public struct AudioSourceData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs index f8ada5c2..56fefd62 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs @@ -9,7 +9,9 @@ using System.Collections; namespace Fungus { - + /// + /// Boolean variable type. + /// [VariableInfo("", "Boolean")] [AddComponentMenu("")] [System.Serializable] @@ -38,6 +40,9 @@ namespace Fungus } + /// + /// Container for a Boolean variable reference or constant value. + /// [System.Serializable] public struct BooleanData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs index 560b3455..56bea5d2 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Color variable type. + /// [VariableInfo("Other", "Color")] [AddComponentMenu("")] [System.Serializable] public class ColorVariable : VariableBase {} + /// + /// Container for a Color variable reference or constant value. + /// [System.Serializable] public struct ColorData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs index a1a982d0..34d4972e 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs @@ -8,6 +8,9 @@ using System.Collections; namespace Fungus { + /// + /// Float variable type. + /// [VariableInfo("", "Float")] [AddComponentMenu("")] [System.Serializable] @@ -46,6 +49,9 @@ namespace Fungus } } + /// + /// Container for an float variable reference or constant value. + /// [System.Serializable] public struct FloatData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs index 0c2f9707..39c5842e 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// GameObject variable type. + /// [VariableInfo("Other", "GameObject")] [AddComponentMenu("")] [System.Serializable] public class GameObjectVariable : VariableBase {} + /// + /// Container for a GameObject variable reference or constant value. + /// [System.Serializable] public struct GameObjectData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs index c8b150b3..43450b4b 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs @@ -8,6 +8,9 @@ using System.Collections; namespace Fungus { + /// + /// Integer variable type. + /// [VariableInfo("", "Integer")] [AddComponentMenu("")] [System.Serializable] @@ -46,6 +49,9 @@ namespace Fungus } } + /// + /// Container for an integer variable reference or constant value. + /// [System.Serializable] public struct IntegerData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs index d5c41b92..686ebfa4 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Material variable type. + /// [VariableInfo("Other", "Material")] [AddComponentMenu("")] [System.Serializable] public class MaterialVariable : VariableBase {} + /// + /// Container for a Material variable reference or constant value. + /// [System.Serializable] public struct MaterialData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs index 09ba223f..de41a9e8 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Object variable type. + /// [VariableInfo("Other", "Object")] [AddComponentMenu("")] [System.Serializable] public class ObjectVariable : VariableBase {} + /// + /// Container for an Object variable reference or constant value. + /// [System.Serializable] public struct ObjectData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs index 5f5b4366..76d95772 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Sprite variable type. + /// [VariableInfo("Other", "Sprite")] [AddComponentMenu("")] [System.Serializable] public class SpriteVariable : VariableBase {} + /// + /// Container for a Sprite variable reference or constant value. + /// [System.Serializable] public struct SpriteData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs index ee1459cd..563650f1 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs @@ -8,7 +8,9 @@ using System.Collections; namespace Fungus { - + /// + /// String variable type. + /// [VariableInfo("", "String")] [AddComponentMenu("")] [System.Serializable] @@ -37,7 +39,7 @@ namespace Fungus } /// - /// Can contain a reference to a StringVariable or a string constant. + /// Container for a string variable reference or constant value. /// Appears as a single line property in the inspector. /// For a multi-line property, use StringDataMulti. /// @@ -86,7 +88,7 @@ namespace Fungus } /// - /// Can contain a reference to a StringVariable or a string constant. + /// Container for a string variable reference or constant value. /// Appears as a multi-line property in the inspector. /// For a single-line property, use StringData. /// diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs index cec9978f..6c2c3e2e 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Texture variable type. + /// [VariableInfo("Other", "Texture")] [AddComponentMenu("")] [System.Serializable] public class TextureVariable : VariableBase {} + /// + /// Container for a Texture variable reference or constant value. + /// [System.Serializable] public struct TextureData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs index 96783a35..f4cfe4a5 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Transform variable type. + /// [VariableInfo("Other", "Transform")] [AddComponentMenu("")] [System.Serializable] public class TransformVariable : VariableBase {} + /// + /// Container for a Transform variable reference or constant value. + /// [System.Serializable] public struct TransformData { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs index 2b8a3cd8..8c8a99e6 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Vector2 variable type. + /// [VariableInfo("Other", "Vector2")] [AddComponentMenu("")] [System.Serializable] public class Vector2Variable : VariableBase {} + /// + /// Container for a Vector2 variable reference or constant value. + /// [System.Serializable] public struct Vector2Data { diff --git a/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs b/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs index 2cc891f2..7b9dd603 100644 --- a/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs +++ b/Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs @@ -8,12 +8,18 @@ using System.Collections; namespace Fungus { + /// + /// Vector3 variable type. + /// [VariableInfo("Other", "Vector3")] [AddComponentMenu("")] [System.Serializable] public class Vector3Variable : VariableBase {} + /// + /// Container for a Vector3 variable reference or constant value. + /// [System.Serializable] public struct Vector3Data {