I've created a series of methods like the following:
Code: Select all
public string PlayerName()
{
return PlayerData.PlayerName;
}
public string PlayerTitle()
{
return PlayerData.CurrentTitle;
}
Code: Select all
void OnEnable()
{
Lua.RegisterFunction("PlayerName", this, SymbolExtensions.GetMethodInfo(() => this.PlayerName()));
Lua.RegisterFunction("PlayerTitle", this, SymbolExtensions.GetMethodInfo(() => this.PlayerTitle()));
}
void OnDisable()
{
Lua.UnregisterFunction("PlayerName");
Lua.UnregisterFunction("PlayerTitle");
}
Code: Select all
DialogManager.masterDatabase.variables.FirstOrDefault(v => v.Name == "PlayerName").InitialValue = sheet.PlayerName;
DialogManager.masterDatabase.variables.FirstOrDefault(v => v.Name == "PlayerTitle").InitialValue = sheet.CurrentTitle;
Code: Select all
Variable["PlayerTitle"] = PlayerTitle();