Beispiel #1
0
 private void OnBlockDespawn(BlockDespawn blockDespawnEvent)
 {
     //Debug.Log("One block broke");
     blockCount--;
     if (blockCount <= 0)
     {
         LevelFinished();
     }
 }
Beispiel #2
0
    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;
        }
    }
Beispiel #3
0
 private void Awake()
 {
     BlockSpawn.RegisterListener(OnBlockSpawn);
     BlockDespawn.RegisterListener(OnBlockDespawn);
 }
Beispiel #4
0
 private void OnDestroy()
 {
     BlockSpawn.UnregisterListener(OnBlockSpawn);
     BlockDespawn.UnregisterListener(OnBlockDespawn);
 }
Beispiel #5
0
    //private void Start() => FireScoreEvent();

    private void OnBlockDespawn(BlockDespawn info)
    {
        currentScore += scorePerBlock;
        FireScoreEvent();
    }
Beispiel #6
0
 private void OnDisable()
 {
     ResetGame.UnregisterListener(onGameRestart);
     BlockDespawn.UnregisterListener(OnBlockDespawn);
     SceneManager.sceneLoaded -= onSceneLoaded;
 }