public void SelectItem()
    {
        string temp = FoodManager.PassObjcetName();

        Debug.Log("The selection is :" + temp);
        switch (temp)
        {
        case "Prop_RubbishBin_02":
            audioManager.Play("Remove");
            inventory.RemoveItem();
            break;

        case "submit":
            CC = FindObjectOfType <CustomerController>();
            CC.CheckFood();
            inventory.RemoveAllItem();
            break;

        case "fireex":
            if (Fire.activeInHierarchy == true)
            {
                audioManager.Play("FireExtinguisher");
                customerSpawn.unhideCustomer();
                Fire.SetActive(false);
                SubmitButton.SetActive(true);
                audioManager.StartPlayBG();
            }
            break;

        case "TurnOffWater":
            if (Water.activeInHierarchy == true)
            {
                customerSpawn.unhideCustomer();
                Water.SetActive(false);
                SubmitButton.SetActive(true);
                audioManager.Play("TurnOffWater");
                audioManager.StartPlayBG();
            }
            break;

        default:
            audioManager.Play("Select");
            item = Resources.Load <Item>(temp);
            Debug.Log(item);
            inventory.AddItem(item);
            break;
        }
    }
Exemple #2
0
    // Update is called once per frame
    public void Update()
    {
        SelectedTime += Time.deltaTime;

        if (SelectedTime >= 3f)
        {
            GetTemp.enabled = false;
            string temp = FoodManager.PassObjcetName();
            Debug.Log("The selection is :" + temp);
            if (temp == "remove")
            {
                audioManager.Play("Remove");
                inventory.RemoveItem();
            }
            else if (temp == "submit")
            {
                CC = FindObjectOfType <CustomerController>();
                CC.CheckFood();
                inventory.RemoveAllItem();
            }
            else
            {
                audioManager.Play("Select");

                if (temp == "TestFood")
                {
                    item = Resources.Load <Item>("fish");
                    Debug.Log(item);
                    inventory.AddItem(item);
                }
                if (temp == "TestFood2")
                {
                    item = Resources.Load <Item>("coin");
                    Debug.Log(item);
                    inventory.AddItem(item);
                }
            }
        }
    }