// Update is called once per frame void Update() { if (hasWon) { Debug.Log(winTransition); winTransition -= Time.deltaTime; backgroundImage.color = new Color(1, 1, 1, 1 - winTransition / WINTRANSITIONTIME); if (winTransition < 0) { switch (SceneManager.GetActiveScene().name) { case "01_Level_TUTO": PlayerPrefs.SetFloat("Photo0", 1); SceneManager.LoadScene("MainMenu"); break; case "02_Level_Cliff": PlayerPrefs.SetFloat("Photo1", 1); SceneManager.LoadScene("MainMenu"); break; case "03_Level_Hole": PlayerPrefs.SetFloat("Photo2", 1); SceneManager.LoadScene("MainMenu"); break; case "04_Level_Final": PlayerPrefs.SetFloat("Photo3", 1); SceneManager.LoadScene("MainMenu"); break; default: SceneManager.LoadScene("MainMenu"); break; } } } // TODO : Remove if (Input.GetKeyDown("n")) { Debug.Log("Cheat code activated"); DayNightManager.SetDay(!DayNightManager.GetDay()); } if (Input.GetKeyDown("r")) { Debug.Log("Reloading level"); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } GetComponentInChildren <InteractionCollider>().canInteract(DayNightManager.GetDay()); if (Input.GetButtonDown("Pickup") && !GetComponent <CharacterMovement>().IsJumping() && !storm.IsFalling()) { Queue <GameObject> items = new Queue <GameObject>(interactibles); if (items.Count > 0) { GameObject item = items.Dequeue(); if (item.CompareTag("Neon") && DayNightManager.GetDay()) { RemoveNeon(item); } if (item.CompareTag("Door") && DayNightManager.GetDay()) { item.GetComponentInParent <DoorManager>().Open(); interactibles.Remove(item); GameObject.Find("Frame").gameObject.SetActive(false); } if (item.CompareTag("Rift")) { Destroy(item); GameObject.FindGameObjectWithTag("Storm").GetComponent <PictureBehaviour>().StartAnimation(); } } } if (Input.GetButtonDown("PlaceObject") && !GetComponent <CharacterMovement>().IsJumping() && !storm.IsFalling() && DayNightManager.GetDay()) { if (currentNeonCount > 0) { PlaceNeon(); } } }