This script synchronizes a behavior tree's shared variables with the Dialogue System's Lua environment. More...
Public Member Functions | |
void | OnConversationStart (Transform actor) |
When a conversation starts, sync to Lua. More... | |
void | OnConversationEnd (Transform actor) |
When a conversation ends, sync from Lua back into the behavior tree. More... | |
void | SyncToLua () |
Syncs the behavior tree's shared variables to the Dialogue System's Lua environment. More... | |
void | SyncFromLua () |
Syncs the Dialogue System's Lua environment back into the behavior tree's shared variables. More... | |
This script synchronizes a behavior tree's shared variables with the Dialogue System's Lua environment.
Attach it to the GameObject that contains the behavior tree. Synchronization occurs automatically at the beginning and end of conversations. You can also synchronize manually by calling SyncToLua() or SyncFromLua().
The Lua variables will have the name gameObjectName_variableName. All blank spaces and hyphens will be converted to underscores. For example, say an NPC named Private Hart has a behavior tree with a shared variable named Angry. The Lua variable will be Variable["Private_Hart_Angry"]
.
Only bools, floats, ints, and strings are synchronized.
void PixelCrushers.DialogueSystem.BehaviorDesigner.BehaviorTreeLuaBridge.OnConversationEnd | ( | Transform | actor | ) |
When a conversation ends, sync from Lua back into the behavior tree.
If the conversation has changed any values, the changes will be reflected in the behavior tree.
actor | The other actor. |
void PixelCrushers.DialogueSystem.BehaviorDesigner.BehaviorTreeLuaBridge.OnConversationStart | ( | Transform | actor | ) |
When a conversation starts, sync to Lua.
This makes the behavior tree data available to conversations in Conditions and User Scripts.
actor | The other actor. |
void PixelCrushers.DialogueSystem.BehaviorDesigner.BehaviorTreeLuaBridge.SyncFromLua | ( | ) |
Syncs the Dialogue System's Lua environment back into the behavior tree's shared variables.
void PixelCrushers.DialogueSystem.BehaviorDesigner.BehaviorTreeLuaBridge.SyncToLua | ( | ) |
Syncs the behavior tree's shared variables to the Dialogue System's Lua environment.