NodeCanvas comes with various Tasks that allow you to make use of existing code and components on game objects, that are well worth mentioning. By using these Tasks a whole lot of different actions can be performed that at the first glance you might think they are missing. Here are a few things that can be done for example by using these Tasks:
Furthermore you can keep all your implementations in your own scripts instead of creating custom action and condition tasks, and use these Tasks to interact with them in an efficient way. Following are the Reflection Tasks included.
This Action will allow you to Execute a Function that takes none or up to six parameters on any Component/Script on the selected Agent and also able to save the return value of that function to a blackboard variable. The value to be used as the parameters can either be directly assigned or taken from blackboard variable.
This Action ends immediately in Success unless the function selected is an IEnumerator in which case it will be executed as a Coroutine! In this case, the action will be running and only return Success after the Coroutine is done.
With the Implemented Action Task, you are able to totally control how long the action will run and what Status it will return. In essence, it forwards the execution of the Task for a function on a script to control. That function must have a signature of public Status and take one or no parameters. For example:
1 2 3 4 5 6 7 8 9 10 |
using NodeCanvas.Framework; public class Example : MonoBehaviour { public Status SomeAction(string text){ Debug.Log(text); return Status.Success; } } |
This Action will allow you to Get a property from any of the selected Agent’s components and store that property to a blackboard variable.
This Action will allow you to set a property on any of the selected Agent’s Components.
This Action will allow you to Get a field from script on the Agent and store it to a blackboard variable.
This Action will allow to set a field on any of the selected Agent’s components.
This Condition will allow you to call a non-void function with up to six parameters and check it directly against a given value.
This Condition will allow you to check any property against a given value, saving you from having to first Get it and then Check it.
This Condition can be used to subscribe to an event of System.Action type or custom handler with 0 arguments and return type of void. As soon as the event is raised, this condition will return true for one frame.