void OnTriggerEnter2D(Collider2D collider) { LaserBullet bullet = collider.gameObject.GetComponent <LaserBullet>(); if (bullet) { life -= bullet.GetDamage(); if (life <= 0) { Die(); } bullet.Hit(); } }
void OnTriggerEnter2D(Collider2D collider) { LaserBullet bullet = collider.gameObject.GetComponent <LaserBullet>(); if (bullet) { life -= bullet.GetDamage(); scorePoint.addScore(hitScorePoint); if (life <= 0) { Destroy(gameObject); AudioSource.PlayClipAtPoint(dieSound, transform.position); } bullet.Hit(); } }