Browse Source

Added GetVariables function

master
CG-Tespy 5 years ago
parent
commit
3bf341c684
  1. 17
      Assets/Fungus/Scripts/Components/Flowchart.cs

17
Assets/Fungus/Scripts/Components/Flowchart.cs

@ -800,6 +800,23 @@ namespace Fungus
return null;
}
/// <summary>
/// Returns a list of variables matching the specified type.
/// </summary>
public IList<T> GetVariables<T>() where T: Variable
{
var varsFound = new List<T>();
for (int i = 0; i < Variables.Count; i++)
{
var currentVar = Variables[i];
if (currentVar is T)
varsFound.Add(currentVar as T);
}
return varsFound;
}
/// <summary>
/// Register a new variable with the Flowchart at runtime.
/// The variable should be added as a component on the Flowchart game object.

Loading…
Cancel
Save