public void Update() { if (Input.GetKeyDown(KeyCode.Space) && !keyEntered) { keyEntered = true; startPos = camera.transform.position; mapPlayer = GameObject.FindGameObjectWithTag("MapPlayer"); } if (Input.GetKeyDown(KeyCode.Space) && shop == true) { } //----Town scene change if (keyEntered == true) { if (Insidebar == true) { SceneManager.LoadScene("Town"); } if (Insidefactory == true) { SceneManager.LoadScene("Town"); } if (Bardoor == true) { SceneManager.LoadScene("Bar"); } if (Dungeondoor == true) { //SceneManager.LoadScene("SampleScene"); scoutingPanel.SetActive(true); Time.timeScale = 0; } if (Blacksmithdoor == true) { SceneManager.LoadScene("Blacksmith"); } } //---- if (Ttrigger == true && keyEntered == true && !monstersTemplates.doorClosed) { FadeIn(); camera.transform.position = Vector3.MoveTowards(camera.transform.position, new Vector3(startPos.x, startPos.y + 9f, startPos.z), speed * Time.deltaTime); if (camera.transform.position == new Vector3(startPos.x, startPos.y + 9f, startPos.z)) { mapPlayer.transform.position = new Vector3(mapPlayer.transform.position.x, mapPlayer.transform.position.y + 0.2817f, mapPlayer.transform.position.z); rcPlayer.teleportToNewPositionT(); FadeOut(); keyEntered = false; Btrigger = false; Ltrigger = false; Rtrigger = false; Ttrigger = false; } } else if (Rtrigger == true && keyEntered == true && !monstersTemplates.doorClosed) { FadeIn(); camera.transform.position = Vector3.MoveTowards(camera.transform.position, new Vector3(startPos.x + 16f, startPos.y, startPos.z), speed * Time.deltaTime); if (camera.transform.position == new Vector3(startPos.x + 16f, startPos.y, startPos.z)) { mapPlayer.transform.position = new Vector3(mapPlayer.transform.position.x + 0.55f, mapPlayer.transform.position.y, mapPlayer.transform.position.z); rcPlayer.teleportToNewPositionR(); FadeOut(); keyEntered = false; Btrigger = false; Ltrigger = false; Rtrigger = false; Ttrigger = false; } } else if (Ltrigger == true && keyEntered == true && !monstersTemplates.doorClosed) { camera.transform.position = Vector3.MoveTowards(camera.transform.position, new Vector3(startPos.x - 16f, startPos.y, startPos.z), speed * Time.deltaTime); FadeIn(); if (camera.transform.position == new Vector3(startPos.x - 16f, startPos.y, startPos.z)) { mapPlayer.transform.position = new Vector3(mapPlayer.transform.position.x - 0.55f, mapPlayer.transform.position.y, mapPlayer.transform.position.z); rcPlayer.teleportToNewPositionL(); FadeOut(); keyEntered = false; Btrigger = false; Ltrigger = false; Rtrigger = false; Ttrigger = false; } } else if (Btrigger == true && keyEntered == true && !monstersTemplates.doorClosed) { FadeIn(); camera.transform.position = Vector3.MoveTowards(camera.transform.position, new Vector3(startPos.x, startPos.y - 9f, startPos.z), speed * Time.deltaTime); if (camera.transform.position == new Vector3(startPos.x, startPos.y - 9f, startPos.z)) { mapPlayer.transform.position = new Vector3(mapPlayer.transform.position.x, mapPlayer.transform.position.y - 0.2817f, mapPlayer.transform.position.z); rcPlayer.teleportToNewPositionB(); FadeOut(); keyEntered = false; Btrigger = false; Ltrigger = false; Rtrigger = false; Ttrigger = false; } } else { keyEntered = false; } }