I am attempting to have a method run to have the character move to a waypoint in a cutscene by using the dialogue script field. I have two methods, LeaveRoom() and EnterRoom() in a navmesh script. Following the example from "How to Use Lua in Your C# Scripts" about registering functions, I had trouble thinking of how these would work with the custom lua script since they aren't using strings/bools/doubles.
Screenshot attached, how would I convert these to a bool/double/string so they can be run on command?
Code: Select all
public void EnterRoom(string enter)
{
if (!navMeshAgent.pathPending && navMeshAgent.remainingDistance < 0.1f)
{
navMeshAgent.destination = waypoints[0].position;
animator.SetBool("isWalking", true);
isMoving = true;
waitToMove = false;
}
}
public void LeaveRoom(string leave)
{
if (!navMeshAgent.pathPending && navMeshAgent.remainingDistance < 0.1f)
{
navMeshAgent.destination = waypoints[1].position;
animator.SetBool("isWalking", true);
isMoving = true;
waitToMove = false;
}
}
void OnEnable()
{
// Make the functions available to Lua: (Replace these lines with your own.)
Lua.RegisterFunction("EnterRoom", this, SymbolExtensions.GetMethodInfo(() => EnterRoom(string.Empty)));
Lua.RegisterFunction("LeaveRoom", this, SymbolExtensions.GetMethodInfo(() => LeaveRoom(string.Empty)));
}
void OnDisable()
{
// Remove the functions from Lua: (Replace these lines with your own.)
Lua.UnregisterFunction("EnterRoom");
Lua.UnregisterFunction("LeaveRoom");
}