Browse Source

Added delay property to Call Method command

https://trello.com/c/a333r2QA
master
chrisgregan 10 years ago
parent
commit
ccb6609879
  1. 17
      Assets/Fungus/Flowchart/Scripts/Commands/CallMethod.cs

17
Assets/Fungus/Flowchart/Scripts/Commands/CallMethod.cs

@ -18,6 +18,9 @@ namespace Fungus
[Tooltip("Name of the method to call")]
public string methodName = "";
[Tooltip("Delay (in seconds) before the method will be called")]
public float delay;
public override void OnEnter()
{
if (targetObject == null ||
@ -27,11 +30,23 @@ namespace Fungus
return;
}
targetObject.SendMessage(methodName, SendMessageOptions.DontRequireReceiver);
if (delay == 0f)
{
CallTheMethod();
}
else
{
Invoke("CallTheMethod", delay);
}
Continue();
}
protected virtual void CallTheMethod()
{
targetObject.SendMessage(methodName, SendMessageOptions.DontRequireReceiver);
}
public override string GetSummary()
{
if (targetObject == null)

Loading…
Cancel
Save