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 Script Control Tasks to interact with them in an efficient way. Following are the Script Control tasks included.
This Action will allow you to Execute a Function that takes none or up to three 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 is 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 totaly control for 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 as 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 as 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 boolean function with no parameters and check it directly against a value
This Condition will allow you to check a boolean property directly against a value, saving you from having to first Get it and then Check it.
This Condition can be used to subscribe to an event of EventHandler 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 that specific frame.