private void OnBlockDespawn(BlockDespawn blockDespawnEvent) { //Debug.Log("One block broke"); blockCount--; if (blockCount <= 0) { LevelFinished(); } }
private void Awake() { int gameStatusCount = FindObjectsOfType <GameStatus>().Length; if (gameStatusCount > 1) { Destroy(gameObject); return; } else { DontDestroyOnLoad(gameObject); ResetGame.RegisterListener(onGameRestart); BlockDespawn.RegisterListener(OnBlockDespawn); SceneManager.sceneLoaded += onSceneLoaded; } }
private void Awake() { BlockSpawn.RegisterListener(OnBlockSpawn); BlockDespawn.RegisterListener(OnBlockDespawn); }
private void OnDestroy() { BlockSpawn.UnregisterListener(OnBlockSpawn); BlockDespawn.UnregisterListener(OnBlockDespawn); }
//private void Start() => FireScoreEvent(); private void OnBlockDespawn(BlockDespawn info) { currentScore += scorePerBlock; FireScoreEvent(); }
private void OnDisable() { ResetGame.UnregisterListener(onGameRestart); BlockDespawn.UnregisterListener(OnBlockDespawn); SceneManager.sceneLoaded -= onSceneLoaded; }