new void Update() { base.Update(); if (!XRDevice.isPresent) { // On left mouse click if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out RaycastHit hit)) { switch (hit.transform.tag) { case "Fireflies": Fireflies firefliesHitted = hit.transform.GetComponent <Fireflies>(); firefliesHitted.Seperate(); break; case "Elevator": Elevator elevator = hit.transform.GetComponentInParent <Elevator>(); elevator.OpenDoors(); break; case "AttractBall": if (attractBall) { attractBall.moveWithMouse = true; } break; } } } else if (Input.GetMouseButtonUp(0) && attractBall) { attractBall.moveWithMouse = false; } // On moving mouse rotationX += mouseRotationSpeed * Input.GetAxis("Mouse X"); rotationY -= mouseRotationSpeed * Input.GetAxis("Mouse Y"); transform.eulerAngles = new Vector3(rotationY, rotationX, 0); // Activate fireflies from lamp if (Input.GetKey("s")) { firstFireflies.ActivateAfterInitialize(); } // Follow attract ball if (attractBall && Input.GetKey("f")) { attractBall.shouldFollow = true; } } }
private void Update() { if (snippetMatches[0] && snippetMatches[1] && snippetMatches[2]) { combinedSnippets = GameObject.FindGameObjectsWithTag("snippet"); foreach (GameObject snippet in combinedSnippets) { snippet.GetComponent <MeshRenderer>().enabled = true; } fireflies.ActivateAfterInitialize(); Destroy(this.gameObject); } }
void Update() { timer -= Time.deltaTime; if (timer <= 0) { timer = 3; counter = 0; for (int i = 0; i < 24; i++) { if (snippetMatches[i] == true) { counter++; } if (counter == 24) { sphereCollider.enabled = true; fireflies.ActivateAfterInitialize(); } } } }