private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { StageIndicator stageIndicator = FindObjectOfType <StageIndicator>(); if (increaseStage) { stageIndicator.IncreaseStage(); } if (stageIndicator.getStage() >= 3) { // trigger end game screen InventoryManager.Instance.EndOfGameScreen.gameObject.SetActive(true); UIFader.Instance.UiElement = InventoryManager.Instance.EndOfGameScreen; UIFader.Instance.FadeIn(); } else { //dont destroy player DontDestroyOnLoad(other.gameObject); //dont destroy inventory GameObject hud = GameObject.FindGameObjectWithTag("HUD"); DontDestroyOnLoad(hud); SceneManager.LoadScene(sceneName); } } }
private void TestStageIndicator() { StageIndicator indicator = GetComponent <StageIndicator>(); if (indicator == null) { return; } indicator.IncreaseStage(); }