Code: Select all
public static double minute, hour, day, second, month, year;
public void SendToDialogueSystem()
{
DialogueLua.SetVariable("Second", second);
DialogueLua.SetVariable("Minute", minute);
DialogueLua.SetVariable("Hour", hour);
DialogueLua.SetVariable("Day", day);
DialogueLua.SetVariable("Month", month);
DialogueLua.SetVariable("Year", year);
}
public void HourTracker(double hourUpdate)
{
hour = (double)hourUpdate;
}
public void DayTracker(double dayUpdate)
{
day = (double)dayUpdate;
}
...
void Update()
{
CalculateTime();
CalculateSeason();
SendToDialogueSystem();
}
...
void OnEnable()
{
// Make the functions available to Lua: (Replace these lines with your own.)
Lua.RegisterFunction("HourTracker", this, SymbolExtensions.GetMethodInfo(() => HourTracker(hour)));
Lua.RegisterFunction("DayTracker", this, SymbolExtensions.GetMethodInfo(() => DayTracker(day)));
}
void OnDisable()
{
Lua.UnregisterFunction("HourTracker");
Lua.UnregisterFunction("DayTracker");
}