Browse Source

Refactored comments

master
Christopher 9 years ago
parent
commit
da678c640b
  1. 82
      Assets/Fungus/Flowchart/Scripts/Block.cs
  2. 168
      Assets/Fungus/Flowchart/Scripts/Command.cs
  3. 13
      Assets/Fungus/Flowchart/Scripts/CommandCopyBuffer.cs
  4. 6
      Assets/Fungus/Flowchart/Scripts/Commands/Break.cs
  5. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Call.cs
  6. 9
      Assets/Fungus/Flowchart/Scripts/Commands/CallMethod.cs
  7. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Comment.cs
  8. 2
      Assets/Fungus/Flowchart/Scripts/Commands/Condition.cs
  9. 4
      Assets/Fungus/Flowchart/Scripts/Commands/DebugLog.cs
  10. 5
      Assets/Fungus/Flowchart/Scripts/Commands/DeleteSaveKey.cs
  11. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs
  12. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Else.cs
  13. 8
      Assets/Fungus/Flowchart/Scripts/Commands/ElseIf.cs
  14. 6
      Assets/Fungus/Flowchart/Scripts/Commands/End.cs
  15. 6
      Assets/Fungus/Flowchart/Scripts/Commands/If.cs
  16. 9
      Assets/Fungus/Flowchart/Scripts/Commands/InvokeEvent.cs
  17. 9
      Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs
  18. 3
      Assets/Fungus/Flowchart/Scripts/Commands/Jump.cs
  19. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Label.cs
  20. 20
      Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs
  21. 5
      Assets/Fungus/Flowchart/Scripts/Commands/LoadVariable.cs
  22. 5
      Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs
  23. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Quit.cs
  24. 4
      Assets/Fungus/Flowchart/Scripts/Commands/RandomFloat.cs
  25. 4
      Assets/Fungus/Flowchart/Scripts/Commands/RandomInteger.cs
  26. 5
      Assets/Fungus/Flowchart/Scripts/Commands/ReadTextFile.cs
  27. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Reset.cs
  28. 7
      Assets/Fungus/Flowchart/Scripts/Commands/SaveVariable.cs
  29. 4
      Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs
  30. 5
      Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs
  31. 3
      Assets/Fungus/Flowchart/Scripts/Commands/SetSaveProfile.cs
  32. 5
      Assets/Fungus/Flowchart/Scripts/Commands/SetVariable.cs
  33. 7
      Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs
  34. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Stop.cs
  35. 5
      Assets/Fungus/Flowchart/Scripts/Commands/StopBlock.cs
  36. 4
      Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs
  37. 5
      Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs
  38. 6
      Assets/Fungus/Flowchart/Scripts/Commands/While.cs
  39. 39
      Assets/Fungus/Flowchart/Scripts/EventHandler.cs
  40. 6
      Assets/Fungus/Flowchart/Scripts/EventHandlers/FlowchartEnabled.cs
  41. 6
      Assets/Fungus/Flowchart/Scripts/EventHandlers/GameStarted.cs
  42. 4
      Assets/Fungus/Flowchart/Scripts/EventHandlers/KeyPressed.cs
  43. 4
      Assets/Fungus/Flowchart/Scripts/EventHandlers/MessageReceived.cs
  44. 428
      Assets/Fungus/Flowchart/Scripts/Flowchart.cs
  45. 9
      Assets/Fungus/Flowchart/Scripts/FungusState.cs
  46. 7
      Assets/Fungus/Flowchart/Scripts/Node.cs
  47. 23
      Assets/Fungus/Flowchart/Scripts/SceneLoader.cs
  48. 6
      Assets/Fungus/Flowchart/Scripts/StringFormatter.cs
  49. 20
      Assets/Fungus/Flowchart/Scripts/Variable.cs
  50. 7
      Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs
  51. 7
      Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs
  52. 7
      Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs
  53. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs
  54. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs
  55. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs
  56. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs
  57. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs
  58. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs
  59. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs
  60. 8
      Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs
  61. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs
  62. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs
  63. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs
  64. 6
      Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs

82
Assets/Fungus/Flowchart/Scripts/Block.cs

@ -11,6 +11,9 @@ using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// A container for a sequence of Fungus comands.
/// </summary>
[ExecuteInEditMode]
[RequireComponent(typeof(Flowchart))]
[AddComponentMenu("")]
@ -22,58 +25,72 @@ namespace Fungus
Executing,
}
/// <summary>
/// The execution state of the Block.
/// </summary>
protected ExecutionState executionState;
public ExecutionState State { get { return executionState; } }
/// <summary>
/// Unique identifier for the Block.
/// </summary>
[SerializeField] protected int itemId = -1; // Invalid flowchart item id
public int ItemId { get { return itemId; } set { itemId = value; } }
/// <summary>
/// The name of the block node as displayed in the Flowchart window.
/// </summary>
[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; } }
/// <summary>
/// Description text to display under the block node
/// </summary>
[TextArea(2, 5)]
[Tooltip("Description text to display under the block node")]
[SerializeField] protected string description = "";
public string Description { get { return description; } }
/// <summary>
/// An optional Event Handler which can execute the block when an event occurs.
/// </summary>
[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; } }
/// <summary>
/// The currently executing command.
/// </summary>
protected Command activeCommand;
public Command ActiveCommand { get { return activeCommand; } }
// Index of last command executed before the current one
// -1 indicates no previous command
/// <summary>
// Index of last command executed before the current one.
// -1 indicates no previous command.
/// </summary>
protected int previousActiveCommandIndex = -1;
public float ExecutingIconTimer { get; set; }
/// <summary>
/// The list of commands in the sequence.
/// </summary>
[SerializeField] protected List<Command> commandList = new List<Command>();
public List<Command> CommandList { get { return commandList; } }
protected int executionCount;
/// <summary>
/// Controls the next command to execute in the block execution coroutine.
/// </summary>
protected int jumpToCommandIndex = -1;
public int JumpToCommandIndex { set { jumpToCommandIndex = value; } }
/**
* Duration of fade for executing icon displayed beside blocks & commands.
*/
/// <summary>
/// Duration of fade for executing icon displayed beside blocks & commands.
/// </summary>
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();
}
/// <summary>
/// Populate the command metadata used to control execution.
/// </summary>
protected virtual void SetExecutionInfo()
{
// Give each child command a reference back to its parent block
@ -125,16 +145,25 @@ namespace Fungus
}
#endif
/// <summary>
/// Returns the parent Flowchart for this Block.
/// </summary>
public virtual Flowchart GetFlowchart()
{
return GetComponent<Flowchart>();
}
/// <summary>
/// Returns true if the Block is executing a command.
/// </summary>
public virtual bool IsExecuting()
{
return (executionState == ExecutionState.Executing);
}
/// <summary>
/// Returns the number of times this Block has executed.
/// </summary>
public virtual int GetExecutionCount()
{
return executionCount;
@ -261,6 +290,9 @@ namespace Fungus
}
}
/// <summary>
/// Stop executing commands in this Block.
/// </summary>
public virtual void Stop()
{
// Tell the executing command to stop immediately
@ -274,6 +306,9 @@ namespace Fungus
jumpToCommandIndex = int.MaxValue;
}
/// <summary>
/// Returns a list of all Blocks connected to this one.
/// </summary>
public virtual List<Block> GetConnectedBlocks()
{
List<Block> connectedBlocks = new List<Block>();
@ -287,6 +322,10 @@ namespace Fungus
return connectedBlocks;
}
/// <summary>
/// Returns the type of the previously executing command.
/// </summary>
/// <returns>The previous active command type.</returns>
public virtual System.Type GetPreviousActiveCommandType()
{
if (previousActiveCommandIndex >= 0 &&
@ -298,6 +337,9 @@ namespace Fungus
return null;
}
/// <summary>
/// Recalculate the indent levels for all commands in the list.
/// </summary>
public virtual void UpdateIndentLevels()
{
int indentLevel = 0;

168
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
{
{
/// <summary>
/// Attribute class for Fungus commands.
/// </summary>
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.
*/
/// <summary>
/// Metadata atribute for the Command class.
/// </summary>
/// <param name="category">The category to place this command in.</param>
/// <param name="commandName">The display name of the command.</param>
/// <param name="helpText">Help information to display in the inspector.</param>
/// <param name="priority">If two command classes have the same name, the one with highest priority is listed. Negative priority removess the command from the list.</param>///
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; }
}
/// <summary>
/// Base class for Commands. Commands can be added to Blocks to create an execution sequence.
/// </summary>
public class Command : MonoBehaviour
{
/// <summary>
/// Unique identifier for this command.
/// Unique for this Flowchart.
/// </summary>
[FormerlySerializedAs("commandId")]
[HideInInspector]
[SerializeField] protected int itemId = -1; // Invalid flowchart item id
public int ItemId { get { return itemId; } set { itemId = value; } }
/// <summary>
/// Error message to display in the command inspector.
/// </summary>
protected string errorMessage = "";
public string ErrorMessage { get { return errorMessage; } }
/// <summary>
/// Indent depth of the current commands.
/// Commands are indented inside If, While, etc. sections.
/// </summary>
[HideInInspector]
[SerializeField] protected int indentLevel;
public int IndentLevel { get { return indentLevel; } set { indentLevel = value; } }
/// <summary>
/// Index of the command in the parent block's command list.
/// </summary>
public int CommandIndex { get; set; }
/**
* Set to true by the parent block while the command is executing.
*/
/// <summary>
/// Set to true by the parent block while the command is executing.
/// </summary>
public bool IsExecuting { get; set; }
/**
* Timer used to control appearance of executing icon in inspector.
*/
/// <summary>
/// Timer used to control appearance of executing icon in inspector.
/// </summary>
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.
*/
/// <summary>
/// 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.
/// </summary>
public Block ParentBlock { get; set; }
/// <summary>
/// Returns the Flowchart that this command belongs to.
/// </summary>
public virtual Flowchart GetFlowchart()
{
Flowchart flowchart = GetComponent<Flowchart>();
@ -82,11 +100,17 @@ namespace Fungus
return flowchart;
}
/// <summary>
/// Execute the command.
/// </summary>
public virtual void Execute()
{
OnEnter();
}
/// <summary>
/// End execution of this command and continue execution at the next command.
/// </summary>
public virtual void Continue()
{
// This is a noop if the Block has already been stopped
@ -96,6 +120,10 @@ namespace Fungus
}
}
/// <summary>
/// End execution of this command and continue execution at a specific command index.
/// </summary>
/// <param name="nextCommandIndex">Next command index.</param>
public virtual void Continue(int nextCommandIndex)
{
OnExit();
@ -105,6 +133,9 @@ namespace Fungus
}
}
/// <summary>
/// Stops the parent Block executing.
/// </summary>
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.
*/
/// <summary>
/// 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.
/// </summary>
public virtual void OnStopExecuting()
{}
/**
* Called when the new command is added to a block in the editor.
*/
/// <summary>
/// Called when the new command is added to a block in the editor.
/// </summary>
public virtual void OnCommandAdded(Block parentBlock)
{}
/**
* Called when the command is deleted from a block in the editor.
*/
/// <summary>
/// Called when the command is deleted from a block in the editor.
/// </summary>
public virtual void OnCommandRemoved(Block parentBlock)
{}
/// <summary>
/// Called when this command starts execution.
/// </summary>
public virtual void OnEnter()
{}
/// <summary>
/// Called when this command ends execution.
/// </summary>
public virtual void OnExit()
{}
/// <summary>
/// Called when this command is reset. This happens when the Reset command is used.
/// </summary>
public virtual void OnReset()
{}
/// <summary>
/// Populates a list with the Blocks that this command references.
/// </summary>
public virtual void GetConnectedBlocks(ref List<Block> connectedBlocks)
{}
/// <summary>
/// Returns true if this command references the variable.
/// Used to highlight variables in the variable list when a command is selected.
/// </summary>
public virtual bool HasReference(Variable variable)
{
return false;
}
/// <summary>
/// Returns the summary text to display in the command inspector.
/// </summary>
public virtual string GetSummary()
{
return "";
}
/// <summary>
/// Returns the help text to display for this command.
/// </summary>
public virtual string GetHelpText()
{
return "";
}
/**
* This command starts a block of commands.
*/
/// <summary>
/// Return true if this command opens a block of commands. Used for indenting commands.
/// </summary>
public virtual bool OpenBlock()
{
return false;
}
/**
* This command ends a block of commands.
*/
/// <summary>
/// Return true if this command closes a block of commands. Used for indenting commands.
/// </summary>
public virtual bool CloseBlock()
{
return false;
}
/**
* Return the color for the command background in inspector.
*/
/// <summary>
/// Return the color for the command background in inspector.
/// </summary>
/// <returns>The button color.</returns>
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.
*/
/// <summary>
/// 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.
/// </summary>
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.
*/
/// <summary>
/// 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.
/// </summary>
public virtual bool IsReorderableArray(string propertyName)
{
return false;
}
/**
* Returns the localization id for the Flowchart that contains this command.
*/
/// <summary>
/// Returns the localization id for the Flowchart that contains this command.
/// </summary>
public virtual string GetFlowchartLocalizationId()
{
// If no localization id has been set then use the Flowchart name
@ -224,7 +278,5 @@ namespace Fungus
return localizationId;
}
}
}

13
Assets/Fungus/Flowchart/Scripts/CommandCopyBuffer.cs

@ -4,20 +4,21 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Temporary buffer object used when copying and pasting commands.
/// </summary>
[AddComponentMenu("")]
public class CommandCopyBuffer : Block
{
protected static CommandCopyBuffer instance;
/**
* Returns the CommandCopyBuffer singleton instance.
* Will create a CommandCopyBuffer game object if none currently exists.
*/
/// <summary>
/// Returns the CommandCopyBuffer singleton instance.
/// Will create a CommandCopyBuffer game object if none currently exists.
/// </summary>
static public CommandCopyBuffer GetInstance()
{
if (instance == null)

6
Assets/Fungus/Flowchart/Scripts/Commands/Break.cs

@ -4,12 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Force a loop to terminate immediately.
/// </summary>
[CommandInfo("Flow",
"Break",
"Force a loop to terminate immediately.")]

5
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
{
/// <summary>
/// Execute another block in the same Flowchart as the command, or in a different Flowchart.
/// </summary>
[CommandInfo("Flow",
"Call",
"Execute another block in the same Flowchart as the command, or in a different Flowchart.")]

9
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.
/// <summary>
/// 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.
/// </summary>
[CommandInfo("Scripting",
"Call Method",
"Calls a named method on a GameObject using the GameObject.SendMessage() system.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/Comment.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Use comments to record design notes and reminders about your game.
/// </summary>
[CommandInfo("",
"Comment",
"Use comments to record design notes and reminders about your game.")]

2
Assets/Fungus/Flowchart/Scripts/Commands/Condition.cs

@ -4,8 +4,6 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{

4
Assets/Fungus/Flowchart/Scripts/Commands/DebugLog.cs

@ -4,10 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Writes a log message to the debug console.
/// </summary>
[CommandInfo("Scripting",
"Debug Log",
"Writes a log message to the debug console.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/DeleteSaveKey.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Deletes a saved value from permanent storage.
/// </summary>
[CommandInfo("Variable",
"Delete Save Key",
"Deletes a saved value from permanent storage.")]

5
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
{
/// <summary>
/// Destroys a specified game object in the scene.
/// </summary>
[CommandInfo("Scripting",
"Destroy",
"Destroys a specified game object in the scene.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/Else.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Marks the start of a command block to be executed when the preceding If statement is False.
/// </summary>
[CommandInfo("Flow",
"Else",
"Marks the start of a command block to be executed when the preceding If statement is False.")]

8
Assets/Fungus/Flowchart/Scripts/Commands/ElseIf.cs

@ -4,20 +4,18 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
namespace Fungus
{
/// <summary>
/// Marks the start of a command block to be executed when the preceding If statement is False and the test expression is true.
/// </summary>
[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();

6
Assets/Fungus/Flowchart/Scripts/Commands/End.cs

@ -4,12 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Marks the end of a conditional block.
/// </summary>
[CommandInfo("Flow",
"End",
"Marks the end of a conditional block.")]

6
Assets/Fungus/Flowchart/Scripts/Commands/If.cs

@ -4,12 +4,12 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// If the test expression is true, execute the following command block.
/// </summary>
[CommandInfo("Flow",
"If",
"If the test expression is true, execute the following command block.")]

9
Assets/Fungus/Flowchart/Scripts/Commands/InvokeEvent.cs

@ -4,20 +4,21 @@
*/
using UnityEngine;
using System.Collections;
using System;
using UnityEngine.Events;
namespace Fungus
{
/// <summary>
/// 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
/// </summary>
[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<bool> {}

9
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
{
/// <summary>
/// Invokes a method of a component via reflection. Supports passing multiple parameters and storing returned values in a Fungus variable.
/// </summary>
[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")]

3
Assets/Fungus/Flowchart/Scripts/Commands/Jump.cs

@ -8,6 +8,9 @@ using UnityEngine.Serialization;
namespace Fungus
{
/// <summary>
/// Move execution to a specific Label command in the same block.
/// </summary>
[CommandInfo("Flow",
"Jump",
"Move execution to a specific Label command in the same block")]

5
Assets/Fungus/Flowchart/Scripts/Commands/Label.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Marks a position in the command list for execution to jump to.
/// </summary>
[CommandInfo("Flow",
"Label",
"Marks a position in the command list for execution to jump to.")]

20
Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs

@ -5,17 +5,21 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// 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.")]
/// </summary>
[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()

5
Assets/Fungus/Flowchart/Scripts/Commands/LoadVariable.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// 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.
/// </summary>
[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.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/OpenURL.cs

@ -4,12 +4,13 @@
*/
using UnityEngine;
using System.Collections;
using Fungus;
namespace Fungus
{
/// <summary>
/// Opens the specified URL in the browser.
/// </summary>
[CommandInfo("Scripting",
"Open URL",
"Opens the specified URL in the browser.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/Quit.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Quits the application. Does not work in Editor or Webplayer builds. Shouldn't generally be used on iOS.
/// </summary>
[CommandInfo("Flow",
"Quit",
"Quits the application. Does not work in Editor or Webplayer builds. Shouldn't generally be used on iOS.")]

4
Assets/Fungus/Flowchart/Scripts/Commands/RandomFloat.cs

@ -4,10 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Sets an float variable to a random value in the defined range.
/// </summary>
[CommandInfo("Variable",
"Random Float",
"Sets an float variable to a random value in the defined range.")]

4
Assets/Fungus/Flowchart/Scripts/Commands/RandomInteger.cs

@ -4,10 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Sets an integer variable to a random value in the defined range.
/// </summary>
[CommandInfo("Variable",
"Random Integer",
"Sets an integer variable to a random value in the defined range.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/ReadTextFile.cs

@ -4,12 +4,13 @@
*/
using UnityEngine;
using System.Collections;
using Fungus;
namespace Fungus
{
/// <summary>
/// Reads in a text file and stores the contents in a string variable.
/// </summary>
[CommandInfo("Variable",
"Read Text File",
"Reads in a text file and stores the contents in a string variable")]

5
Assets/Fungus/Flowchart/Scripts/Commands/Reset.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Resets the state of all commands and variables in the Flowchart.
/// </summary>
[CommandInfo("Variable",
"Reset",
"Resets the state of all commands and variables in the Flowchart.")]

7
Assets/Fungus/Flowchart/Scripts/Commands/SaveVariable.cs

@ -4,11 +4,14 @@
*/
using UnityEngine;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// 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.
/// </summary>
[CommandInfo("Variable",
"Save Variable",
"Save an Boolean, Integer, Float or String variable to persistent storage using a string key. " +

4
Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs

@ -5,10 +5,12 @@
using UnityEngine;
using UnityEngine.Serialization;
using System.Collections;
namespace Fungus
{
/// <summary>
/// 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.
/// </summary>
[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.")]

5
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
{
/// <summary>
/// Sets a game object in the scene to be active / inactive.
/// </summary>
[CommandInfo("Scripting",
"Set Active",
"Sets a game object in the scene to be active / inactive.")]

3
Assets/Fungus/Flowchart/Scripts/Commands/SetSaveProfile.cs

@ -9,6 +9,9 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// 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.
/// </summary>
[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.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/SetVariable.cs

@ -4,10 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// 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.
/// </summary>
[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")]

7
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.
/// <summary>
/// Spawns a new object based on a reference to a scene or prefab game object.
/// </summary>
[CommandInfo("Scripting",
"Spawn Object",
"Spawns a new object based on a reference to a scene or prefab game object.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/Stop.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Stop executing the Block that contains this command.
/// </summary>
[CommandInfo("Flow",
"Stop",
"Stop executing the Block that contains this command.")]

5
Assets/Fungus/Flowchart/Scripts/Commands/StopBlock.cs

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Stops executing the named Block.
/// </summary>
[CommandInfo("Flow",
"Stop Block",
"Stops executing the named Block")]

4
Assets/Fungus/Flowchart/Scripts/Commands/StopFlowchart.cs

@ -4,11 +4,13 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Stops execution of all Blocks in a Flowchart.
/// </summary>
[CommandInfo("Flow",
"Stop Flowchart",
"Stops execution of all Blocks in a Flowchart")]

5
Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs

@ -5,11 +5,12 @@
using UnityEngine;
using UnityEngine.Serialization;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Waits for period of time before executing the next command in the block.
/// </summary>
[CommandInfo("Flow",
"Wait",
"Waits for period of time before executing the next command in the block.")]

6
Assets/Fungus/Flowchart/Scripts/Commands/While.cs

@ -4,12 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Continuously loop through a block of commands while the condition is true. Use the Break command to force the loop to terminate immediately.
/// </summary>
[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.")]

39
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
{
/// <summary>
/// Attribute class for Fungus event handlers.
/// </summary>
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.
*/
/// <summary>
/// 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.
/// </summary>
[RequireComponent(typeof(Block))]
[RequireComponent(typeof(Flowchart))]
[AddComponentMenu("")]
public class EventHandler : MonoBehaviour
{
/// <summary>
/// Returns the parent Block which owns this Event Handler.
/// </summary>
/// <value>The parent block.</value>
[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.
*/
/// <summary>
/// The Event Handler should call this method when the event is detected.
/// </summary>
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.
*/
/// <summary>
/// Returns custom summary text for the event handler.
/// </summary>
public virtual string GetSummary()
{
return "";

6
Assets/Fungus/Flowchart/Scripts/EventHandlers/FlowchartEnabled.cs

@ -4,12 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// The block will execute when the Flowchart game object is enabled.
/// </summary>
[EventHandlerInfo("",
"Flowchart Enabled",
"The block will execute when the Flowchart game object is enabled.")]

6
Assets/Fungus/Flowchart/Scripts/EventHandlers/GameStarted.cs

@ -4,12 +4,12 @@
*/
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// The block will execute when the game starts playing.
/// </summary>
[EventHandlerInfo("",
"Game Started",
"The block will execute when the game starts playing.")]

4
Assets/Fungus/Flowchart/Scripts/EventHandlers/KeyPressed.cs

@ -4,10 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// The block will execute when a key press event occurs.
/// </summary>
[EventHandlerInfo("Input",
"Key Pressed",
"The block will execute when a key press event occurs.")]

4
Assets/Fungus/Flowchart/Scripts/EventHandlers/MessageReceived.cs

@ -4,10 +4,12 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// The block will execute when the specified message is received from a Send Message command.
/// </summary>
[EventHandlerInfo("",
"Message Received",
"The block will execute when the specified message is received from a Send Message command.")]

428
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.
*/
/// <summary>
/// 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.
/// </summary>
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.
*/
/// <summary>
/// Visual scripting controller for the Flowchart programming language.
/// Flowchart objects may be edited visually using the Flowchart editor window.
/// </summary>
[ExecuteInEditMode]
public class Flowchart : MonoBehaviour, StringSubstituter.ISubstitutionHandler
{
/**
* The current version of the Flowchart. Used for updating components.
*/
/// <summary>
/// The current version of the Flowchart. Used for updating components.
/// </summary>
public const int CURRENT_VERSION = 1;
/**
* The name of the initial block in a new flowchart.
*/
/// <summary>
/// The name of the initial block in a new flowchart.
/// </summary>
public const string DEFAULT_BLOCK_NAME = "New Block";
/**
* Variable to track flowchart's version so components can update to new versions.
*/
/// <summary>
/// Variable to track flowchart's version so components can update to new versions.
/// </summary>
[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.
*/
/// <summary>
/// Scroll position of Flowchart editor window.
/// </summary>
[HideInInspector]
[SerializeField] protected Vector2 scrollPos;
public Vector2 ScrollPos { get { return scrollPos; } set { scrollPos = value; } }
/**
* Scroll position of Flowchart variables window.
*/
/// <summary>
/// Scroll position of Flowchart variables window.
/// </summary>
[HideInInspector]
[SerializeField] protected Vector2 variablesScrollPos;
public Vector2 VariablesScrollPos { get { return variablesScrollPos; } set { variablesScrollPos = value; } }
/**
* Show the variables pane.
*/
/// <summary>
/// Show the variables pane.
/// </summary>
[HideInInspector]
[SerializeField] protected bool variablesExpanded = true;
public bool VariablesExpanded { get { return variablesExpanded; } set { variablesExpanded = value; } }
/**
* Height of command block view in inspector.
*/
/// <summary>
/// Height of command block view in inspector.
/// </summary>
[HideInInspector]
[SerializeField] protected float blockViewHeight = 400;
public float BlockViewHeight { get { return blockViewHeight; } set { blockViewHeight = value; } }
/**
* Zoom level of Flowchart editor window
*/
/// <summary>
/// Zoom level of Flowchart editor window.
/// </summary>
[HideInInspector]
[SerializeField] protected float zoom = 1f;
public float Zoom { get { return zoom; } set { zoom = value; } }
/**
* Scrollable area for Flowchart editor window.
*/
/// <summary>
/// Scrollable area for Flowchart editor window.
/// </summary>
[HideInInspector]
[SerializeField] protected Rect scrollViewRect;
public Rect ScrollViewRect { get { return scrollViewRect; } set { scrollViewRect = value; } }
/**
* Currently selected block in the Flowchart editor.
*/
/// <summary>
/// Currently selected block in the Flowchart editor.
/// </summary>
[HideInInspector]
[FormerlySerializedAs("selectedSequence")]
[SerializeField] protected Block selectedBlock;
public Block SelectedBlock { get { return selectedBlock; } set { selectedBlock = value; } }
/**
* Currently selected command in the Flowchart editor.
*/
/// <summary>
/// Currently selected command in the Flowchart editor.
/// </summary>
[HideInInspector]
[SerializeField] protected List<Command> selectedCommands = new List<Command>();
public List<Command> SelectedCommands { get { return selectedCommands; } }
/**
* The list of variables that can be accessed by the Flowchart.
*/
/// <summary>
/// The list of variables that can be accessed by the Flowchart.
/// </summary>
[HideInInspector]
[SerializeField] protected List<Variable> variables = new List<Variable>();
public List<Variable> Variables { get { return variables; } }
/// <summary>
/// Description text displayed in the Flowchart editor window
/// </summary>
[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.
*/
/// <summary>
/// Slow down execution in the editor to make it easier to visualise program flow.
/// </summary>
[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.
*/
/// <summary>
/// Use command color when displaying the command list in the inspector.
/// </summary>
[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")]
/// <summary>
/// Hides the Flowchart block and command components in the inspector.
/// Deselect to inspect the block and command components that make up the Flowchart.
/// </summary>
[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.")]
/// <summary>
/// Saves the selected block and commands when saving the scene. Helps avoid version control conflicts if you've only changed the active selection.
/// </summary>
[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.
*/
/// <summary>
/// Unique identifier for identifying this flowchart in localized string keys.
/// </summary>
[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.
*/
/// <summary>
/// Display line numbers in the command list in the Block inspector.
/// </summary>
[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.
*/
/// <summary>
/// List of commands to hide in the Add Command menu. Use this to restrict the set of commands available when editing a Flowchart.
/// </summary>
[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<string> hideCommands = new List<string>();
/// <summary>
/// Lua Environment to be used by default for all Execute Lua commands in this Flowchart.
/// </summary>
[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.
*/
/// <summary>
/// The ExecuteLua command adds a global Lua variable with this name bound to the flowchart prior to executing.
/// </summary>
[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.
*/
/// <summary>
/// Position in the center of all blocks in the flowchart.
/// </summary>
public Vector2 CenterPosition { set; get; }
/**
* Cached list of flowchart objects in the scene for fast lookup
*/
/// <summary>
/// Cached list of flowchart objects in the scene for fast lookup.
/// </summary>
public static List<Flowchart> cachedFlowcharts = new List<Flowchart>();
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.
*/
/// <summary>
/// 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.
/// </summary>
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.
*/
/// <summary>
/// Create a new block node which you can then add commands to.
/// </summary>
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.
*/
/// <summary>
/// Returns the named Block in the flowchart, or null if not found.
/// </summary>
public virtual Block FindBlock(string blockName)
{
Block [] blocks = GetComponents<Block>();
@ -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.
*/
/// <summary>
/// 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.
*/
/// <summary>
/// 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.
/// </summary>
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.
*/
/// <summary>
/// Stop all executing Blocks in this Flowchart.
/// </summary>
public virtual void StopAllBlocks()
{
Block [] blocks = GetComponents<Block>();
@ -516,10 +501,10 @@ namespace Fungus
}
}
/**
* Sends a message to this Flowchart only.
* Any block with a matching MessageReceived event handler will start executing.
*/
/// <summary>
/// Sends a message to this Flowchart only.
/// Any block with a matching MessageReceived event handler will start executing.
/// </summary>
public virtual void SendFungusMessage(string messageName)
{
MessageReceived[] eventHandlers = GetComponents<MessageReceived>();
@ -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.
*/
/// <summary>
/// Sends a message to all Flowchart objects in the current scene.
/// Any block with a matching MessageReceived event handler will start executing.
/// </summary>
public static void BroadcastFungusMessage(string messageName)
{
MessageReceived[] eventHandlers = UnityEngine.Object.FindObjectsOfType<MessageReceived>();
@ -542,9 +527,9 @@ namespace Fungus
}
}
/**
* Returns a new variable key that is guaranteed not to clash with any existing variable in the list.
*/
/// <summary>
/// Returns a new variable key that is guaranteed not to clash with any existing variable in the list.
/// </summary>
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.
*/
/// <summary>
/// Returns a new Block key that is guaranteed not to clash with any existing Block in the Flowchart.
/// </summary>
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.
*/
/// <summary>
/// Returns a new Label key that is guaranteed not to clash with any existing Label in the Block.
/// </summary>
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;
*/
/// <summary>
/// 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;
/// </summary>
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<BooleanVariable>("MyBool");
* boolVar.Value = false;
*/
/// <summary>
/// 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<BooleanVariable>("MyBool");
/// boolVar.Value = false;
/// </summary>
public T GetVariable<T>(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.
*/
/// <summary>
/// Register a new variable with the Flowchart at runtime.
/// The variable should be added as a component on the Flowchart game object.
/// </summary>
public void SetVariable<T>(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.
*/
/// <summary>
/// Gets a list of all variables with public scope in this Flowchart.
/// </summary>
public virtual List<Variable> GetPublicVariables()
{
List<Variable> publicVariables = new List<Variable>();
@ -757,10 +742,10 @@ namespace Fungus
return publicVariables;
}
/**
* Gets the value of a boolean variable.
* Returns false if the variable key does not exist.
*/
/// <summary>
/// Gets the value of a boolean variable.
/// Returns false if the variable key does not exist.
/// </summary>
public virtual bool GetBooleanVariable(string key)
{
BooleanVariable variable = GetVariable<BooleanVariable>(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.
*/
/// <summary>
/// Sets the value of a boolean variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetBooleanVariable(string key, bool value)
{
BooleanVariable variable = GetVariable<BooleanVariable>(key);
@ -788,10 +773,10 @@ namespace Fungus
}
}
/**
* Gets the value of an integer variable.
* Returns 0 if the variable key does not exist.
*/
/// <summary>
/// Gets the value of an integer variable.
/// Returns 0 if the variable key does not exist.
/// </summary>
public virtual int GetIntegerVariable(string key)
{
IntegerVariable variable = GetVariable<IntegerVariable>(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.
*/
/// <summary>
/// Sets the value of an integer variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetIntegerVariable(string key, int value)
{
IntegerVariable variable = GetVariable<IntegerVariable>(key);
@ -819,10 +804,10 @@ namespace Fungus
}
}
/**
* Gets the value of a float variable.
* Returns 0 if the variable key does not exist.
*/
/// <summary>
/// Gets the value of a float variable.
/// Returns 0 if the variable key does not exist.
/// </summary>
public virtual float GetFloatVariable(string key)
{
FloatVariable variable = GetVariable<FloatVariable>(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.
*/
/// <summary>
/// Sets the value of a float variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetFloatVariable(string key, float value)
{
FloatVariable variable = GetVariable<FloatVariable>(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.
*/
/// <summary>
/// Gets the value of a string variable.
/// Returns the empty string if the variable key does not exist.
/// </summary>
public virtual string GetStringVariable(string key)
{
StringVariable variable = GetVariable<StringVariable>(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.
*/
/// <summary>
/// Sets the value of a string variable.
/// The variable must already be added to the list of variables for this Flowchart.
/// </summary>
public virtual void SetStringVariable(string key, string value)
{
StringVariable variable = GetVariable<StringVariable>(key);
@ -881,9 +866,9 @@ namespace Fungus
}
}
/**
* Set the block objects to be hidden or visible depending on the hideComponents property.
*/
/// <summary>
/// Set the block objects to be hidden or visible depending on the hideComponents property.
/// </summary>
public virtual void UpdateHideFlags()
{
if (hideComponents)
@ -927,11 +912,17 @@ namespace Fungus
}
/// <summary>
/// Clears the list of selected commands.
/// </summary>
public virtual void ClearSelectedCommands()
{
selectedCommands.Clear();
}
/// <summary>
/// Adds a command to the list of selected commands.
/// </summary>
public virtual void AddSelectedCommand(Command command)
{
if (!selectedCommands.Contains(command))
@ -940,6 +931,9 @@ namespace Fungus
}
}
/// <summary>
/// Reset the commands and variables in the Flowchart.
/// </summary>
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.
*/
/// <summary>
/// Override this in a Flowchart subclass to filter which commands are shown in the Add Command list.
/// </summary>
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.
*/
/// <summary>
/// Returns true if there are any executing blocks in this Flowchart.
/// </summary>
public virtual bool HasExecutingBlocks()
{
Block[] blocks = GetComponents<Block>();
@ -994,9 +988,9 @@ namespace Fungus
return false;
}
/**
* Returns a list of all executing blocks in this Flowchart.
*/
/// <summary>
/// Returns a list of all executing blocks in this Flowchart.
/// </summary>
public virtual List<Block> GetExecutingBlocks()
{
List<Block> executingBlocks = new List<Block>();
@ -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.
*/
/// <summary>
/// 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.
/// </summary>
[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).
*/
/// <summary>
/// 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).
/// </summary>
public virtual string SubstituteVariables(string input)
{
if (stringSubstituer == null)

9
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.
/// <summary>
/// Used by the Flowchart window to serialize the currently active Flowchart object
/// so that the same Flowchart can be displayed while editing & playing.
/// </summary>
[AddComponentMenu("")]
public class FungusState : MonoBehaviour
{
[SerializeField] protected Flowchart selectedFlowchart;
public Flowchart SelectedFlowchart { get { return selectedFlowchart; } set { selectedFlowchart = value; } }
}

7
Assets/Fungus/Flowchart/Scripts/Node.cs

@ -4,17 +4,16 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Base class for Flowchart nodes.
/// </summary>
[AddComponentMenu("")]
public class Node : MonoBehaviour
{
[SerializeField] protected Rect nodeRect = new Rect(0, 0, 120, 30);
public Rect _NodeRect { get { return nodeRect; } set { nodeRect = value; } }
}
}

23
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.
*/
/// <summary>
/// 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.
/// </summary>
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.
*/
/// <summary>
/// Asynchronously load a new scene.
/// </summary>
/// <param name="_sceneToLoad">The name of the scene to load. Scenes must be added in project build settings.</param>
/// <param name="_loadingTexture">Loading image to display while loading the new scene.</param>
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.

6
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
{
/// <summary>
/// Misc string formatting functions.
/// </summary>
public class StringFormatter
{
public static string[] FormatEnumNames(Enum e, string firstLabel)

20
Assets/Fungus/Flowchart/Scripts/Variable.cs

@ -5,17 +5,21 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Scope types for Variables.
/// </summary>
public enum VariableScope
{
Private,
Public
}
/// <summary>
/// Attribute class for variables.
/// </summary>
public class VariableInfoAttribute : Attribute
{
public VariableInfoAttribute(string category, string variableType, int order = 0)
@ -30,6 +34,9 @@ namespace Fungus
public int Order { get; set; }
}
/// <summary>
/// Attribute class for variable properties.
/// </summary>
public class VariablePropertyAttribute : PropertyAttribute
{
public VariablePropertyAttribute (params System.Type[] variableTypes)
@ -48,24 +55,27 @@ namespace Fungus
public System.Type[] VariableTypes { get; set; }
}
/// <summary>
/// Abstract base class for variables.
/// </summary>
[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();
}
/// <summary>
/// Generic concrete base class for variables.
/// </summary>
public abstract class VariableBase<T> : Variable
{
[SerializeField] protected T value;
public T Value { get { return this.value; } set { this.value = value; } }
protected T startValue;

7
Assets/Fungus/Flowchart/Scripts/VariableTypes/AnimatorVariable.cs

@ -4,16 +4,21 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Animator variable type.
/// </summary>
[VariableInfo("Other", "Animator")]
[AddComponentMenu("")]
[System.Serializable]
public class AnimatorVariable : VariableBase<Animator>
{}
/// <summary>
/// Container for an Animator variable reference or constant value.
/// </summary>
[System.Serializable]
public struct AnimatorData
{

7
Assets/Fungus/Flowchart/Scripts/VariableTypes/AudioSourceVariable.cs

@ -4,16 +4,21 @@
*/
using UnityEngine;
using System.Collections;
namespace Fungus
{
/// <summary>
/// AudioSource variable type.
/// </summary>
[VariableInfo("Other", "AudioSource")]
[AddComponentMenu("")]
[System.Serializable]
public class AudioSourceVariable : VariableBase<AudioSource>
{}
/// <summary>
/// Container for an AudioSource variable reference or constant value.
/// </summary>
[System.Serializable]
public struct AudioSourceData
{

7
Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs

@ -9,7 +9,9 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Boolean variable type.
/// </summary>
[VariableInfo("", "Boolean")]
[AddComponentMenu("")]
[System.Serializable]
@ -38,6 +40,9 @@ namespace Fungus
}
/// <summary>
/// Container for a Boolean variable reference or constant value.
/// </summary>
[System.Serializable]
public struct BooleanData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Color variable type.
/// </summary>
[VariableInfo("Other", "Color")]
[AddComponentMenu("")]
[System.Serializable]
public class ColorVariable : VariableBase<Color>
{}
/// <summary>
/// Container for a Color variable reference or constant value.
/// </summary>
[System.Serializable]
public struct ColorData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs

@ -8,6 +8,9 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Float variable type.
/// </summary>
[VariableInfo("", "Float")]
[AddComponentMenu("")]
[System.Serializable]
@ -46,6 +49,9 @@ namespace Fungus
}
}
/// <summary>
/// Container for an float variable reference or constant value.
/// </summary>
[System.Serializable]
public struct FloatData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// GameObject variable type.
/// </summary>
[VariableInfo("Other", "GameObject")]
[AddComponentMenu("")]
[System.Serializable]
public class GameObjectVariable : VariableBase<GameObject>
{}
/// <summary>
/// Container for a GameObject variable reference or constant value.
/// </summary>
[System.Serializable]
public struct GameObjectData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs

@ -8,6 +8,9 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Integer variable type.
/// </summary>
[VariableInfo("", "Integer")]
[AddComponentMenu("")]
[System.Serializable]
@ -46,6 +49,9 @@ namespace Fungus
}
}
/// <summary>
/// Container for an integer variable reference or constant value.
/// </summary>
[System.Serializable]
public struct IntegerData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Material variable type.
/// </summary>
[VariableInfo("Other", "Material")]
[AddComponentMenu("")]
[System.Serializable]
public class MaterialVariable : VariableBase<Material>
{}
/// <summary>
/// Container for a Material variable reference or constant value.
/// </summary>
[System.Serializable]
public struct MaterialData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Object variable type.
/// </summary>
[VariableInfo("Other", "Object")]
[AddComponentMenu("")]
[System.Serializable]
public class ObjectVariable : VariableBase<Object>
{}
/// <summary>
/// Container for an Object variable reference or constant value.
/// </summary>
[System.Serializable]
public struct ObjectData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Sprite variable type.
/// </summary>
[VariableInfo("Other", "Sprite")]
[AddComponentMenu("")]
[System.Serializable]
public class SpriteVariable : VariableBase<Sprite>
{}
/// <summary>
/// Container for a Sprite variable reference or constant value.
/// </summary>
[System.Serializable]
public struct SpriteData
{

8
Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs

@ -8,7 +8,9 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// String variable type.
/// </summary>
[VariableInfo("", "String")]
[AddComponentMenu("")]
[System.Serializable]
@ -37,7 +39,7 @@ namespace Fungus
}
/// <summary>
/// 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.
/// </summary>
@ -86,7 +88,7 @@ namespace Fungus
}
/// <summary>
/// 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.
/// </summary>

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Texture variable type.
/// </summary>
[VariableInfo("Other", "Texture")]
[AddComponentMenu("")]
[System.Serializable]
public class TextureVariable : VariableBase<Texture>
{}
/// <summary>
/// Container for a Texture variable reference or constant value.
/// </summary>
[System.Serializable]
public struct TextureData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/TransformVariable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Transform variable type.
/// </summary>
[VariableInfo("Other", "Transform")]
[AddComponentMenu("")]
[System.Serializable]
public class TransformVariable : VariableBase<Transform>
{}
/// <summary>
/// Container for a Transform variable reference or constant value.
/// </summary>
[System.Serializable]
public struct TransformData
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Vector2 variable type.
/// </summary>
[VariableInfo("Other", "Vector2")]
[AddComponentMenu("")]
[System.Serializable]
public class Vector2Variable : VariableBase<Vector2>
{}
/// <summary>
/// Container for a Vector2 variable reference or constant value.
/// </summary>
[System.Serializable]
public struct Vector2Data
{

6
Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs

@ -8,12 +8,18 @@ using System.Collections;
namespace Fungus
{
/// <summary>
/// Vector3 variable type.
/// </summary>
[VariableInfo("Other", "Vector3")]
[AddComponentMenu("")]
[System.Serializable]
public class Vector3Variable : VariableBase<Vector3>
{}
/// <summary>
/// Container for a Vector3 variable reference or constant value.
/// </summary>
[System.Serializable]
public struct Vector3Data
{

Loading…
Cancel
Save