Browse Source

Merge pull request #792 from CG-Tespy/FlowchartUtils

Added GetVariables function to Flowchart class
master
Steve Halliwell 5 years ago committed by GitHub
parent
commit
7f4b5cc22c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 virtual List<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