public static Task <AIResult> Exec(GameObject gameObject, AITreeNode tree, Dictionary <string, object> arguments, AITreeAsset asset = null) { if (gameObject.GetComponent <BaseAIBehaviours>() == null) { gameObject.AddComponent <BaseAIBehaviours>(); } TaskCompletionSource <AIResult> result = new TaskCompletionSource <AIResult>(); var executor = gameObject.AddComponent <AIExecutor>(); executor.result = result; executor.asset = asset; executor.arguments = arguments; executor.executionTree = tree .Call( new AIExecutionContext( gameObject, executor.Log, null, new TreeArguments( executor.arguments, gameObject.GetComponent <AIMemory>()))) .GetEnumerator(); return(result.Task); }
public IEnumerable <AIResult> Call(AIExecutionContext context, AITreeAsset asset, params (string argName, object argValue)[] arguments)
public static Task <AIResult> Exec(GameObject gameObject, AITreeAsset asset, Dictionary <string, object> arguments) { return(Exec(gameObject, asset.root, arguments, asset)); }