This is the code snippet where the sitting is supposed to happen:
yield return new WaitUntil(() => isOrderTaken);
currentState = CustomerState.GoingToTable;
if (activeAnimator != null)
activeAnimator.UpdateAnimations(false, true);
Transform chair = FindFreeTable();
if (chair != null)
{
agent.SetDestination(chair.position);
yield return StartCoroutine(HasReachedDestination());
agent.isStopped = true;
agent.ResetPath();
transform.position = reservedChair.chairTransform.position;
transform.rotation = reservedChair.chairTransform.rotation;
agent.updatePosition = false;
agent.updateRotation = false;
if (activeAnimator != null)
{
activeAnimator.UpdateAnimations(true, false);
}
Vector3 lookDir = reservedTable.transform.position - transform.position;
lookDir.y = 0;
if (lookDir != Vector3.zero)
transform.rotation = Quaternion.LookRotation(lookDir);
}
currentState = CustomerState.WaitingForFood;
Debug.Log($"{gameObject.name} is waiting for food.");
if (activeAnimator != null)
activeAnimator.UpdateAnimations(true, false);
The chair.position is basically the sitting position. And FindFreeTable function returns the sitting position of a chair that's free.