private void OnDestroy() { GamePauser gamePauser = GamePauser.Singleton; if (gamePauser != null) { gamePauser.RemovePauseHelper(this); } }
private void Awake() { if (GamePauser.Instance == null) { GamePauser.Instance = this; } else if (GamePauser.Instance != null && GamePauser.Instance != this) { Destroy(this.gameObject); } }
private void Start() { Transform canvasTransform = FindObjectOfType <Canvas>().transform; pausedPosition = canvasTransform.position; Vector3 deltaPos = new Vector3(0, ((RectTransform)canvasTransform).sizeDelta.y, 0); deltaPos += new Vector3(0, ((RectTransform)panel.transform).sizeDelta.y + 300, 0); resumedPosition = canvasTransform.position + deltaPos; panel.transform.position = resumedPosition; panel.gameObject.SetActive(false); gamePauser = FindObjectOfType <GamePauser>(); }
///////////////////////////////////////////////////////////////////////////// // //Initializers // private void Start() { if (GamePauser.singleton == null) { singleton = this; } else { if (!ReferenceEquals(this, singleton)) { Destroy(gameObject); } } pauseMenu = FindObjectOfType <PauseMenu>(); }
void Start() { ReadyToPlay readyToPlay = new ReadyToPlay(modeText, leaderboard); LevelSelecter levelSelecter = new LevelSelecter(modeText); GameRunner gameRunner = new GameRunner(blockMover, scoreboardFactory, audioPlayer); GamePauser gamePauser = new GamePauser(modeText, audioPlayer); GameEnder gameEnder = new GameEnder(modeText, blockField); GameRestarter gameRestarter = new GameRestarter(modeText, leaderboard); gameRunner.gravity = gravity; readyToPlay.LevelSelecter = levelSelecter; levelSelecter.GameRunner = gameRunner; gameRunner.GamePauser = gamePauser; gameRunner.GameEnder = gameEnder; gameEnder.GameRestarter = gameRestarter; gameRestarter.StartScreen = readyToPlay; readyToPlay.Show(); currentMode = readyToPlay; }