lab
2016-03-28
lightweight ai behaviour trees framework for Unity 3D
|
Component to control ai behaviour. More...
Inherits MonoBehaviour.
Public Member Functions | |
void | SetInt (string key, int val) |
Sets int parameters for ai behaviour. More... | |
int | GetInt (string key) |
Gets int parameters for ai behaviour. More... | |
void | SetFloat (string key, float val) |
Sets float parameters for ai behaviour. More... | |
float | GetFloat (string key) |
Gets float parameters for ai behaviour. More... | |
void | SetBool (string key, bool val) |
Sets bool parameters for ai behaviour. More... | |
bool | GetBool (string key) |
Gets bool parameters for ai behaviour. More... | |
void | SetString (string key, string val) |
Sets string parameters for ai behaviour. More... | |
string | GetString (string key) |
Gets string parameters for ai behaviour. More... | |
bool | Run (int i=0) |
Runs tree behaviour. More... | |
Properties | |
AiBehaviour | Behaviour [get, set] |
Gets/Sets Behaviour for current AiController. More... | |
List< ATaskScript > | Tasks [get, set] |
Sets/Gets task list. More... | |
IntParameter.KeyCollection | IntKeys [get] |
Gets all int parameters keys. More... | |
FloatParameter.KeyCollection | FloatKeys [get] |
Gets all float parameters keys. More... | |
BoolParameter.KeyCollection | BoolKeys [get] |
Gets all bool parameters keys. More... | |
StringParameter.KeyCollection | StringKyes [get] |
Gets all string parameters keys. More... | |
Component to control ai behaviour.
AiController inherits from MonoBehaviour, so this one should be attached to your game object. It is also responsible for binding tasks scripts with the logic (trees' tasks). Simply attach an AiBehaviour asset and tasks scripts. Use AiController to modificate AiBehaviour's parameters. Each AiController has its own copy of state for attached AiBehaviour, that means you can use same behaviour trees for many controllers.
This sample shows how to update parameters for current controller and run default behaviour tree.
bool lab.AiController.GetBool | ( | string | key | ) |
Gets bool parameters for ai behaviour.
key | The name of the bool parameters. |
float lab.AiController.GetFloat | ( | string | key | ) |
Gets float parameters for ai behaviour.
key | The name of the float parameters. |
int lab.AiController.GetInt | ( | string | key | ) |
Gets int parameters for ai behaviour.
key | The name of the int parameters. |
string lab.AiController.GetString | ( | string | key | ) |
Gets string parameters for ai behaviour.
key | The name of the string parameters. |
bool lab.AiController.Run | ( | int | i = 0 | ) |
Runs tree behaviour.
i | Index of tree to run. Default value is 0. |
void lab.AiController.SetBool | ( | string | key, |
bool | val | ||
) |
Sets bool parameters for ai behaviour.
key | The name of the bool parameters. |
val | The new value for the bool parameters. |
void lab.AiController.SetFloat | ( | string | key, |
float | val | ||
) |
Sets float parameters for ai behaviour.
key | The name of the float parameters. |
val | The new value for the float parameters. |
void lab.AiController.SetInt | ( | string | key, |
int | val | ||
) |
Sets int parameters for ai behaviour.
key | The name of the int parameters. |
val | The new value for the int parameters. |
void lab.AiController.SetString | ( | string | key, |
string | val | ||
) |
Sets string parameters for ai behaviour.
key | The name of the string parameters. |
val | The new value for the string parameters. |
|
getset |
Gets/Sets Behaviour for current AiController.
|
get |
Gets all bool parameters keys.
|
get |
Gets all float parameters keys.
|
get |
Gets all int parameters keys.
|
get |
Gets all string parameters keys.
|
getset |
Sets/Gets task list.