Пример #1
0
 public void DeactivateSaucePanel()
 {
     saucePanel.SetActive(false);
     if (selectedObj.tag == "Plate")
     {
         SushiController sushiController = selectedObj.GetComponentInParent <SushiController>();
         sushiController.DeselectSaucePlate(true);
         sushiController.DeselectSaucePlate(false);
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        GameObject[] systems = GameObject.FindGameObjectsWithTag("ParticleSystem");

        // Update broken and consumed plate count
        GameObject.Find("nConsumed").GetComponent <Text>().text = platesConsumed.ToString();
        GameObject.Find("nBroken").GetComponent <Text>().text   = platesBroken.ToString();


        if (Input.GetMouseButtonDown(0))
        {
            /* Return if the mouse is over a UI object */
            if (IsPointerOverUIObject() || EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }
            //if (EventSystem.current.IsPointerOverGameObject())
            //return;
            //       if (EventSystem.current.IsPointerOverGameObject() ||
            //EventSystem.current.currentSelectedGameObject != null)
            //{
            //    return;

            //}
            //UnityEngine.EventSystems.EventSystem evtSys = UnityEngine.EventSystems.EventSystem.current;
            //if (evtSys.IsPointerOverGameObject() || evtSys.currentSelectedGameObject != null)
            //return;

            Ray        inputRay = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit info;
            if (Physics.Raycast(inputRay, out info))
            {
                if (info.collider.gameObject.tag != "NonSelectable")
                {
                    selectedObj = info.collider.gameObject;
                }

                Debug.Log(selectedObj.name);

                if (selectedObj.tag == "Chef")
                {
                    chefPanel.SetActive(true);
                    DeactivateSaucePanel();
                    DeactivateBeltPanel();
                    camPanel.SetActive(false);
                }


                if (selectedObj.tag == "Sauce")
                {
                    saucePanel.SetActive(true);
                    DeactivateBeltPanel();
                    DeactivateChefPanel();
                    camPanel.SetActive(false);

                    SushiController sushiController = selectedObj.GetComponentInParent <SushiController>();
                    if (selectedObj.name == "Inner Sauce Plate")
                    {
                        sushiController.DeselectSaucePlate(false);
                        saucePanel.transform.Find("Slider").GetComponent <Slider>().value = sushiController.inner_speed;
                    }
                    else
                    {
                        sushiController.DeselectSaucePlate(true);
                        saucePanel.transform.Find("Slider").GetComponent <Slider>().value = sushiController.outer_speed;
                    }
                }
            }
        }


        foreach (GameObject ps in systems)
        {
            if (!ps.GetComponent <ParticleSystem>().IsAlive())
            {
                Destroy(ps);
            }
        }

        KaitenController ctrl           = GameObject.Find("Kaiten Zushi").GetComponent <KaitenController>();
        ChefController   chefController = GameObject.Find("Chef").GetComponent <ChefController>();

        if (beltPanel.activeInHierarchy)
        {
            beltPanel.transform.Find("Slider").GetComponent <Slider>().value = ctrl.prevSpeed;
        }
        else if (chefPanel.activeInHierarchy)
        {
            chefPanel.transform.Find("Slider").GetComponent <Slider>().value = chefController.coolDown;
        }
        else if (camPanel.activeInHierarchy)
        {
            camPanel.transform.Find("Speed").GetComponentInChildren <Slider>().value = cameraTranslateSpeed;
        }


        if (!restaurantMode)
        {
            Camera.main.transform.Translate(Vector3.forward * cameraTranslateSpeed * Time.deltaTime);
        }
    }