IAgent
IAgent
Access Behave.Runtime.IAgent
Description
This is the interface you will be implementing on scripts responsible for handling action and decorator invokes. The interface itself is quite short and simple, but I will add in here the documentation on the action and decorator handlers which are automatically reflected and hooked up to your tree instances on creation.
What this basically means is that any method following a specific pattern of naming and declaration will be recognised as the handler for an action or decorator during the instantiation process of a tree. This is very similar to how Start, Awake and other events are automatically detected and invoked on Unity MonoBehaviours without being part of the MonoBehaviour class definition.
Your absolute bare minimum implementation of an agent is to just implement the Tick and Reset methods of the interface which means whenever an action or decorator is ticked or reset, those methods will be invoked. If you set up forwards/handlers for actions and decorators, those will be used in stead.
Remember that in stead of relying on automatic registration of handlers, you can always use the SetForward methods of the Tree class to manually specify which method should handle a given action or decorator. This also has the advantage of being able to cluster handling of related actions/decorators in a single method.
Methods
BehaveResult Tick (Tree sender, bool init);
void Reset (Tree sender);
int SelectTopPriority (Tree sender, params int[] IDs);
Recognised handlers
public BehaveResult Init{Name}{Action|Decorator} (Tree sender, string stringParameter, float floatParameter, IAgent agent, object data);
public BehaveResult Tick{Name}{Action|Decorator} (Tree sender, string stringParameter, float floatParameter, IAgent agent, object data);
public void Reset{Name}{Action|Decorator} (Tree sender, string stringParameter, float floatParameter, IAgent agent, object data);
public BehaveResult Init{Name}{Action|Decorator} (Tree sender);
public BehaveResult Tick{Name}{Action|Decorator} (Tree sender);
public void Reset{Name}{Action|Decorator} (Tree sender);
public BehaveResult {Name}{Action|Decorator} {get; set;} // For properties, get is recognised as the tick handler and set as the reset handler. You are not required to implement both for one to be recognised.
Hello Mr. Johansen, congratulations for his work on AI and its tool for Unity, I am new to the concept of AI, has long since started using Unity (3.3) and I noticed your tool to make the AI games, since I read his notes on how to use it but frankly I did not understand many things, even try to use the demo file but unfortunately does not work for the current versions of Unity, it is possible to put an updated version in order to understand a little more the functionality of the tool?, thank you for your attention, you have a great day.
I do have plans to release a demo for Behave. Unfortunately I decided to prioritize that below some upcoming features, so it might be a while. I would suggest checking out the Behave forum thread. Users have posted lots of Q&As there. You’ll find it linked to from http://angryant.com/behave/documentation