Example #1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.collider.CompareTag("Ball"))
     {
         health--;
         if (health <= 0)
         {
             Data.Instance.score        += 10;
             Data.Instance.scoreCounter += 10;
             mainSceneManager.OnBlockDestroyed();
             StartCoroutine(DestroyThis());
             blockAudio[0].Play();
         }
         else if (health == 1)
         {
             blockAudio[1].Play();
             spriteRenderer.color = baseColor;
         }
         else if (health == 2)
         {
             blockAudio[1].Play();
             spriteRenderer.color = secondColor;
         }
     }
 }