public void CmdSeatCustomer(GameObject detectedObject, GameObject player) { // Debug.Log("NetworkedCustomerInteraction - CmdSeatCustomer"); // Debug.Log("NetworkedCustomerInteraction - Detected object: " + detectedObject.tag); //get table's table script TableScript tableScript = detectedObject.GetComponent <TableScript>(); var heldCustomer = player.transform.GetChild(0).GetChild(1).GetChild(0).gameObject; //if table has enough seats if (tableScript.CheckSufficientSeats(heldCustomer.GetComponent <CustomerBehaviour_BeingHeld>().groupSizeNum)) { GetQueueingCustomerPatience(detectedObject); RpcSeatCustomer(player, detectedObject); //DECREASE GameManager.Instance.currentNumWaitingCustomers -= 1; } else { // Debug.Log("Not enough seats"); } }
//When the player is looking at a table and is carrying a customer, public void SeatCustomer(List <GameObject> playerInventory, GameObject tableGameobj) { // Debug.Log("Seat customer method called"); if (!tableGameobj.GetComponent <TableScript>()) { //Debug.Log("player is not looking at table"); return; } if (!playerInventory.Contains(customerBeingHeld)) { //Debug.Log("player is not holding customer??"); return; } TableScript tableScript = tableGameobj.GetComponent <TableScript>(); //If the table has enough seats for the group of customers, if (tableScript.CheckSufficientSeats(customerBeingHeld.GetComponent <CustomerBehaviour_Queueing>().GroupSizeNum)) { //Debug.Log("Enough seats for customers"); //disallow tables from being detected TableColliderManager.Instance.ToggleTableDetection(false); //remove the customer from the inventory playerInventory.Remove(customerBeingHeld); //stop holding the customer + activate the customers at the table Destroy(customerBeingHeld.gameObject); customerBeingHeld = null; PlayerInteractionManager.ChangePlayerState(PlayerInteractionManager.PlayerState.Default, true); } }