// Start is called before the first frame update void Start() { ctrl = GameObject.Find("Kaiten Zushi").GetComponent <KaitenController>(); game_state = GameObject.Find("GameState").GetComponent <GameState>(); mat = ctrl.belt_mat; ctrl.belt_mat.color = Color.gray; }
void ReduceSpeed() { KaitenController ctrl = GameObject.Find("Kaiten Zushi").GetComponent <KaitenController>(); if (ctrl.prevSpeed > 0) { ctrl.prevSpeed--; } }
public void DeactivateBeltPanel() { KaitenController ctrl = GameObject.Find("Kaiten Zushi").GetComponent <KaitenController>(); beltPanel.SetActive(false); ctrl.belt_mat.color = Color.gray; ctrl.beltSpeed = ctrl.prevSpeed; paused = false; WakeUpPlates(); }
void CloseWindow() { KaitenController ctrl = GameObject.Find("Kaiten Zushi").GetComponent <KaitenController>(); if (beltPanel.activeInHierarchy) { DeactivateBeltPanel(); } else if (saucePanel.activeInHierarchy) { //saucePanel.SetActive(false); DeactivateSaucePanel(); } else if (camPanel.activeInHierarchy) { camPanel.SetActive(false); paused = false; } else { DeactivateChefPanel(); } }
// 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); } }
void SetBeltSpeed(float value) { KaitenController ctrl = GameObject.Find("Kaiten Zushi").GetComponent <KaitenController>(); ctrl.prevSpeed = (int)value; }