Пример #1
0
    void giveObjectToCustomer(customer cus)
    {
        //TEST
        if (ItemHeld)
        {
            Transform o = GrabPoint.GetChild(0);
            Transform c = cus.GetComponent<Transform>().GetChild(1);
            GM.boxes.Remove(o);
            o.SetParent(c);
            o.transform.localPosition = Vector3.zero;
            ItemHeld = false;
            cus.ExitWH();
            GM.HappyCustom ++;
            GM.SpaceLeft--;

            if(GM.CustomersSpawned < GM.LevelCustomers[GM.level])
            {
                GM.SpawnCustomer();
            }

            if (o.GetComponent<Box>().BoxTypeRec)
            {
                GM.score -= 50;
                GM.Upsetcustom++;
                cus.Annoyed.gameObject.SetActive(true);
            }
            else
            {
                GM.score += 20;
            }
            for (int x = 0; x < GM.Queue.Length; x++)
            {
                GM.Queue[x].Ready = true;
            }
            for (int i = 0; i < GM.customers.Count; i++)
            {
                GM.customers[i].GetComponent<customer>().UpdateQueuePosition();
            }

            if(GM.customers.Count == 0)
            {
                GM.FinishLevel();
            }
        }
        //END TEST
    }