void Update() { if (player.getHealth() <= 0) { RoomNodes.done = 0; BossDoorSelection.clearList(); SceneManager.LoadScene(0); } }
// Update is called once per frame void Update() { //tempRigid.y -= gravity * Time.deltaTime; //player.transform.position += tempRigid * Time.deltaTime; if (player.GetComponent <PlayerStats> ().getHealth() <= 0) { if (!gameOver.activeSelf) { gameOver.SetActive(true); } if (OVRInput.Get(OVRInput.Button.One) || OVRInput.Get(OVRInput.Button.Two) || OVRInput.Get(OVRInput.Button.Three) || OVRInput.Get(OVRInput.Button.Four)) { RoomNodes.done = 0; BossDoorSelection.clearList(); SceneManager.LoadScene(0); } } else { if (currentTime >= timeTillPress) { pressMap = false; } //Movement if (OVRInput.Get(OVRInput.Button.Two)) { rb.MovePosition(player.transform.position + camera.transform.forward * Time.deltaTime * speed); } if (OVRInput.Get(OVRInput.Button.One)) { rb.MovePosition(player.transform.position - camera.transform.forward * Time.deltaTime * speed / 2); } if (OVRInput.Get(OVRInput.Button.Start)) { SceneManager.LoadScene(1); } if (OVRInput.Get(OVRInput.Button.Four) && !pressMap) { if (map.activeSelf == false) { map.SetActive(true); } else { map.SetActive(false); } pressMap = true; currentTime = 0f; } currentTime += Time.deltaTime; } }
public void setInPath() { ++roomsInPath; if (possibleBossDoor != null) { BossDoorSelection.addDoor(ID, possibleBossDoor); } if (Mathf.Abs(transform.position.x - playerStart.x) > 1 && Mathf.Abs(transform.position.z - playerStart.z) > 1) { if (Random.Range(0, 10) == Random.Range(0, 10) || ((float)chestSpawned / (float)roomsInPath) < 0.1) { ++chestSpawned; Instantiate(chestPrefab, transform.position + new Vector3(0f, 0.05f, 0f), chestPrefab.transform.rotation); } else if (Random.Range(0, 10) == Random.Range(0, 10)) { Instantiate(healthPotPrefab, transform.position + new Vector3(2.5f, 0.25f, 2.5f), healthPotPrefab.transform.rotation); } } inPath = true; }