Example #1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.name == "Projectile(Clone)")
     {
         ScoreScript.Add();
         health--;
         col.gameObject.GetComponent <Projectile>().onDeath();
         if (health == 0)
         {
             onDeath();
         }
     }
 }
Example #2
0
 private void Die()
 {
     AudioSource.PlayClipAtPoint(deathSfx, this.transform.position);
     scoreInstance.Add(1);
     Destroy(gameObject);
 }