private void FindShieldUIController(Scene loadedScene, LoadSceneMode arg1) { if (loadedScene.buildIndex == GameManager.instance.GetMainGameSceneNumber()) { isShieldUnlocked = false; shieldUI = FindObjectOfType <ShieldUIManager>(); shieldUI.gameObject.SetActive(isShieldUnlocked); shieldIsCharged = false; shieldUI.OnShieldIsCharged += EnableShieldActivation; AfterDeathOptions.instance.OnTryAgainNow += ResetShield; AfterDeathOptions.instance.OnSkip += ResetShield; shieldController.gameObject.SetActive(false); } }
private void Start() { DontDestroyOnLoad(this); audioPlayer = GetComponent <AudioSource>(); shieldController = GetComponentInChildren <ShieldController>(); shieldController.gameObject.SetActive(false); if (shieldUI == null) { shieldUI = FindObjectOfType <ShieldUIManager>(); } shieldUI.gameObject.SetActive(false); ScoreManager.OnReachedShieldUnlockRoom += UnlockShield; AfterDeathOptions.instance.OnTryAgainNow += ResetShield; AfterDeathOptions.instance.OnSkip += ResetShield; AfterDeathOptions.instance.OnTryAgainLater += ResetShield; PlayerHealthSystem.instance.OnPlayerDied += WriteLog; SceneManager.sceneLoaded += FindShieldUIController; }