Browse Source

Removed delay property from Invoke Method

Invoke Method supports calling coroutine functions with the option to
stop or wait until the coroutine exits before continuing with the next
command. This conflicts with the concept of delaying invocation of the
method until later and continuing immediately. Rather than have a hard
to understand interaction it’s better to just let users add a Wait
command before Invoke Command when they want to introduce a delay.
master
chrisgregan 9 years ago
parent
commit
34b269bd0f
  1. 17
      Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs

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

@ -14,9 +14,6 @@ namespace Fungus
"Invokes a method of a component via reflection. Supports passing multiple parameters and storing returned values in a Fungus variable.")] "Invokes a method of a component via reflection. Supports passing multiple parameters and storing returned values in a Fungus variable.")]
public class InvokeMethod : Command public class InvokeMethod : Command
{ {
[Tooltip("Delay before invoking method")]
public float delay;
[Tooltip("GameObject containing the component method to be invoked")] [Tooltip("GameObject containing the component method to be invoked")]
public GameObject targetObject; public GameObject targetObject;
@ -94,18 +91,6 @@ namespace Fungus
public override void OnEnter() public override void OnEnter()
{ {
if (delay <= 0)
{
DoInvokeMethod();
}
else
{
Invoke("DoInvokeMethod", delay);
}
}
protected virtual void DoInvokeMethod()
{
try try
{ {
if (targetObject == null || string.IsNullOrEmpty(targetComponentAssemblyName) || string.IsNullOrEmpty(targetMethod)) if (targetObject == null || string.IsNullOrEmpty(targetComponentAssemblyName) || string.IsNullOrEmpty(targetMethod))
@ -129,7 +114,7 @@ namespace Fungus
{ {
StartCoroutine(ExecuteCoroutine()); StartCoroutine(ExecuteCoroutine());
if(callMode == Call.CallMode.Continue) if (callMode == Call.CallMode.Continue)
{ {
Continue(); Continue();
} }

Loading…
Cancel
Save