PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge Class Reference

This script synchronizes a behavior tree's shared variables with the Dialogue System's Lua environment. More...

Inheritance diagram for PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge:
Collaboration diagram for PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge:

Public Member Functions

void OnConversationStart (Transform actor)
 When a conversation starts, sync to Lua.
 
void OnConversationEnd (Transform actor)
 When a conversation ends, sync from Lua back into the behavior tree.
 
void SyncToLua ()
 Syncs the behavior tree's shared variables to the Dialogue System's Lua environment.
 
void SyncFromLua ()
 Syncs the Dialogue System's Lua environment back into the behavior tree's shared variables.
 

Static Public Member Functions

static void RegisterLuaFunctions ()
 
static void bdSyncToLua (string gameObjectName)
 
static void bdSyncFromLua (string gameObjectName)
 
static T bdGetVariableValue< T > (string gameObjectName, string variableName, int group=-1)
 
static void bdSetVariableValue< T > (string gameObjectName, string variableName, T variableValue, int group=-1)
 
static bool bdGetBool (string gameObjectName, string variableName)
 
static double bdGetFloat (string gameObjectName, string variableName)
 
static double bdGetInt (string gameObjectName, string variableName)
 
static string bdGetString (string gameObjectName, string variableName)
 
static void bdSetBool (string gameObjectName, string variableName, bool variableValue)
 
static void bdSetFloat (string gameObjectName, string variableName, double variableValue)
 
static void bdSetInt (string gameObjectName, string variableName, double variableValue)
 
static void bdSetString (string gameObjectName, string variableName, string variableValue)
 
static bool bdGetBoolGroup (string gameObjectName, double group, string variableName)
 
static double bdGetFloatGroup (string gameObjectName, double group, string variableName)
 
static double bdGetIntGroup (string gameObjectName, double group, string variableName)
 
static string bdGetStringGroup (string gameObjectName, double group, string variableName)
 
static void bdSetBoolGroup (string gameObjectName, double group, string variableName, bool variableValue)
 
static void bdSetFloatGroup (string gameObjectName, double group, string variableName, double variableValue)
 
static void bdSetIntGroup (string gameObjectName, double group, string variableName, double variableValue)
 
static void bdSetStringGroup (string gameObjectName, double group, string variableName, string variableValue)
 
static BehaviorTreeLuaBridge FindBridge (string gameObjectName)
 
static Behavior FindBehavior (string gameObjectName, int group=-1)
 

Detailed Description

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.

This script also adds some Lua functions:

  • bdSyncToLua(gameObject)
  • bdSyncFromLua(gameObject) where gameObject is the name of a GameObject with a behavior tree.

Member Function Documentation

◆ bdGetBool()

static bool PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetBool ( string  gameObjectName,
string  variableName 
)
inlinestatic

◆ bdGetBoolGroup()

static bool PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetBoolGroup ( string  gameObjectName,
double  group,
string  variableName 
)
inlinestatic

◆ bdGetFloat()

static double PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetFloat ( string  gameObjectName,
string  variableName 
)
inlinestatic

◆ bdGetFloatGroup()

static double PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetFloatGroup ( string  gameObjectName,
double  group,
string  variableName 
)
inlinestatic

◆ bdGetInt()

static double PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetInt ( string  gameObjectName,
string  variableName 
)
inlinestatic

◆ bdGetIntGroup()

static double PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetIntGroup ( string  gameObjectName,
double  group,
string  variableName 
)
inlinestatic

◆ bdGetString()

static string PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetString ( string  gameObjectName,
string  variableName 
)
inlinestatic

◆ bdGetStringGroup()

static string PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetStringGroup ( string  gameObjectName,
double  group,
string  variableName 
)
inlinestatic

◆ bdGetVariableValue< T >()

static T PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdGetVariableValue< T > ( string  gameObjectName,
string  variableName,
int  group = -1 
)
inlinestatic

◆ bdSetBool()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetBool ( string  gameObjectName,
string  variableName,
bool  variableValue 
)
inlinestatic

◆ bdSetBoolGroup()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetBoolGroup ( string  gameObjectName,
double  group,
string  variableName,
bool  variableValue 
)
inlinestatic

◆ bdSetFloat()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetFloat ( string  gameObjectName,
string  variableName,
double  variableValue 
)
inlinestatic

◆ bdSetFloatGroup()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetFloatGroup ( string  gameObjectName,
double  group,
string  variableName,
double  variableValue 
)
inlinestatic

◆ bdSetInt()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetInt ( string  gameObjectName,
string  variableName,
double  variableValue 
)
inlinestatic

◆ bdSetIntGroup()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetIntGroup ( string  gameObjectName,
double  group,
string  variableName,
double  variableValue 
)
inlinestatic

◆ bdSetString()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetString ( string  gameObjectName,
string  variableName,
string  variableValue 
)
inlinestatic

◆ bdSetStringGroup()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetStringGroup ( string  gameObjectName,
double  group,
string  variableName,
string  variableValue 
)
inlinestatic

◆ bdSetVariableValue< T >()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSetVariableValue< T > ( string  gameObjectName,
string  variableName,
variableValue,
int  group = -1 
)
inlinestatic

◆ bdSyncFromLua()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSyncFromLua ( string  gameObjectName)
inlinestatic

◆ bdSyncToLua()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.bdSyncToLua ( string  gameObjectName)
inlinestatic

◆ FindBehavior()

static Behavior PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.FindBehavior ( string  gameObjectName,
int  group = -1 
)
inlinestatic

◆ FindBridge()

static BehaviorTreeLuaBridge PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.FindBridge ( string  gameObjectName)
inlinestatic

◆ OnConversationEnd()

void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.OnConversationEnd ( Transform  actor)
inline

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.

Parameters
actorThe other actor.

◆ OnConversationStart()

void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.OnConversationStart ( Transform  actor)
inline

When a conversation starts, sync to Lua.

This makes the behavior tree data available to conversations in Conditions and User Scripts.

Parameters
actorThe other actor.

◆ RegisterLuaFunctions()

static void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.RegisterLuaFunctions ( )
inlinestatic

◆ SyncFromLua()

void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.SyncFromLua ( )
inline

Syncs the Dialogue System's Lua environment back into the behavior tree's shared variables.

◆ SyncToLua()

void PixelCrushers.DialogueSystem.BehaviorDesignerSupport.BehaviorTreeLuaBridge.SyncToLua ( )
inline

Syncs the behavior tree's shared variables to the Dialogue System's Lua environment.


The documentation for this class was generated from the following file: