// Use this for initialization protected virtual void Start() { PMR_EventManager.StartListening(PMR_EventSetup.Game.SET_VELOCITY, SetVelocity); PMR_EventManager.StartListening(PMR_EventSetup.Game.END_COUNTDOWN, StartTheGame); PMR_EventManager.StartListening(PMR_EventSetup.Game.SHOW_END_PANEL, StopGame); originalPos = new Vector3(transform.position.x, transform.position.y, transform.position.z); }
void StopAllListeners() { if (PMR_EventManager.Instance) { PMR_EventManager.StopListening(PMR_EventSetup.Game.PAUSE_GAME, CheckPause); PMR_EventManager.StopListening(PMR_EventSetup.Game.UNPAUSE_GAME, CheckUnPause); } }
/// <summary> /// Coroutine called for loading the next scene /// </summary> /// <param name="_index"></param> /// <param name="_delayAfterLoading"></param> /// <param name="_eventName"></param> /// <returns></returns> IEnumerator LoadingScreen(int _index, float _delayAfterLoading = 1f, string _eventName = "") { m_loadingScreenGroup.SetActive(true); m_loadingText.text = PMR_TextManager.GetText(PMR_TextSetup.LoadingScreen.LOADING_TEXT); AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(_index); // Wait until the asynchronous scene fully loads while (!asyncLoad.isDone) { yield return(null); } yield return(new WaitForSeconds(_delayAfterLoading)); m_loadingScreenGroup.SetActive(false); if (_eventName != "") { PMR_EventManager.TriggerEvent(_eventName); } }
protected virtual void OnDestroy() { PMR_EventManager.StopListening(PMR_EventSetup.Game.SET_VELOCITY, SetVelocity); PMR_EventManager.StopListening(PMR_EventSetup.Game.END_COUNTDOWN, StartTheGame); PMR_EventManager.StopListening(PMR_EventSetup.Game.SHOW_END_PANEL, StopGame); }
void StartAllListeners() { PMR_EventManager.StartListening(PMR_EventSetup.Game.PAUSE_GAME, CheckPause); PMR_EventManager.StartListening(PMR_EventSetup.Game.UNPAUSE_GAME, CheckUnPause); }