void Start() { player = GameObject.FindGameObjectWithTag("Player"); entrance = GameObject.FindGameObjectWithTag("Entrance"); ET_Square = GameObject.FindGameObjectWithTag("Entrance_Square"); ET_Light = GameObject.FindGameObjectWithTag("EntranceLight"); rend = ET_Square.GetComponent <Renderer>(); if (!lvStarted) { prevLV = PreviousLV.Main; } }
public void ReadyToEnter() { Vector3 playerPos = player.transform.position; Vector3 entrance = ET_Square.transform.position; rend.material.color = Color.blue; if (Vector3.Distance(playerPos, entrance) < 1.0f) { readyToEnter = true; rend.material.color = Color.yellow; ET_Light.SetActive(true); if (Input.GetKeyDown(KeyCode.E)) { lvStarted = true; if (prevLV == PreviousLV.Main) { prevLV = PreviousLV.Shoes; SceneManager.LoadScene("Level_Turorial"); } else if (prevLV == PreviousLV.Shoes) { prevLV = PreviousLV.Building; SceneManager.LoadScene("Level_Building"); } else if (prevLV == PreviousLV.Building) { prevLV = PreviousLV.Bank; SceneManager.LoadScene("Level_Bank"); } else if (prevLV == PreviousLV.Bank) { prevLV = PreviousLV.Subway; SceneManager.LoadScene("Level_Train"); } } } else { readyToEnter = false; ET_Light.SetActive(false); } }