public void selectCustomer()
 {
     firstCustomerSelected = true;
     foreach (GameObject x in tables)
     {
         tableScript tableManager = x.GetComponent <tableScript>();
         if (!tableManager.isOccupied())
         {
             //HighLight x
             Color B = Highlight(defaultColor); // Highlight Color
             x.GetComponentInChildren <Renderer>().material.SetColor("_Color", B);
             x.tag = "Free Table";
         }
     }
 }
Exemple #2
0
    private void Update()
    {
        if (currentStatus == (int)status.MOVING_TO_TABLE && nav.remainingDistance < 8)
        {
            playerAnimator.SetBool("walking", false);
            tableScript tsRef = currentApproachingTable.GetComponent <tableScript>();
            if (!currentApproachingTable.GetComponent <tableScript>().isFree())
            {
                if (tutorial && !placeOrderTutorialDisplayed)
                {
                    placeOrderTutorialDisplayed = true;
                    tutorialController.Display("placeOrder", 500);
                }
                transform.position  = tsRef.waitingPosition.position;
                transform.rotation  = tsRef.waitingPosition.rotation;
                tsRef.arrow.enabled = false;
                tsRef.orderTaken(this);
                calculateArrows();
            }
            nav.enabled   = false;
            currentStatus = (int)status.FREE;
        }
        else if (currentStatus == (int)status.MOVING_TO_KITCHEN && nav.remainingDistance < 5)
        {
            playerAnimator.SetBool("walking", false);
            currentStatus = (int)status.FREE;
            nav.enabled   = false;

            kitchenScript ksRef = kitchenCounter.GetComponent <kitchenScript>();
            transform.position = ksRef.orderingPosition.position;
            transform.rotation = ksRef.orderingPosition.rotation;
            while (orders.Count != 0)
            {
                ksRef.addToCooking(orders.Dequeue());
            }
            if (ksRef.foodReady() && !handFull)
            {
                if (tutorial && !servingCustomerTutorialDisplayed)
                {
                    servingCustomerTutorialDisplayed = true;
                    tutorialController.Display("servingCustomer", 100);
                }
                foodInHand = ksRef.ReleaseFood();
                handFull   = true;
                tableScript tsRef = currentApproachingTable.GetComponent <tableScript>();
                foodInHandReference = Instantiate(foodInHand.obj, handPosition);
                foodInHandReference.transform.localPosition = new Vector3(0, 0, 0);
                foodInHandReference.transform.localScale    = Vector3.one;
                gameController.GetComponent <arrowManager>().ReCalculateArrows(foodInHand.name);
            }
        }
        else if (currentStatus == (int)status.MOVING_TO_SERVE && nav.remainingDistance < 8)
        {
            playerAnimator.SetBool("walking", false);
            nav.enabled   = false;
            currentStatus = (int)status.FREE;
            if (!currentApproachingTable.GetComponent <tableScript>().isFree())
            {
                if (tutorial && !trashTutorialDisplayed)
                {
                    trashTutorialDisplayed = true;
                    tutorialController.Display("trash", 100);
                }
                handFull = false;
                tableScript tsRef = currentApproachingTable.GetComponent <tableScript>();
                Destroy(foodInHandReference);
                tsRef.serveFood();
                transform.position = tsRef.waitingPosition.position;
                transform.rotation = tsRef.waitingPosition.rotation;
                calculateArrows();
            }
        }
        else if (currentStatus == (int)status.COLLECTING_TIP && nav.remainingDistance < 8)
        {
            playerAnimator.SetBool("walking", false);
            tableScript tsRef = currentApproachingTable.GetComponent <tableScript>();
            currentStatus      = (int)status.FREE;
            nav.enabled        = false;
            transform.position = tsRef.waitingPosition.position;
            transform.rotation = tsRef.waitingPosition.rotation;
            int cashInHand = tsRef.CollectTip();
            gameController.GetComponent <MoneyManager>().AddScore(cashInHand);
            if (tutorial)
            {
                tutorialController.Display("end", 100);
            }
        }
        else if (currentStatus == (int)status.MOVING_TO_TRASH && nav.remainingDistance < 5)
        {
            playerAnimator.SetBool("walking", false);
            nav.enabled   = false;
            currentStatus = (int)status.FREE;
            Destroy(foodInHandReference);
            handFull           = false;
            transform.position = trashPosition.position;
            transform.rotation = trashPosition.rotation;
            calculateArrows();
        }
        else if (currentStatus == (int)status.MOVING_TO_QUEUE && nav.remainingDistance < 5)
        {
            if (tutorial && !seating2CustomerTutorialDisplayed)
            {
                seating2CustomerTutorialDisplayed = true;
                tutorialController.Display("seating2", 100);
            }
            playerAnimator.SetBool("walking", false);
            nav.enabled        = false;
            currentStatus      = (int)status.FREE;
            transform.position = waitingQueuePosition.position;
            transform.rotation = trashPosition.rotation;
            gameController.GetComponent <CustomerSelector>().selectCustomer();
        }
    }