void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Player") { Debug.Log("Start"); scoreKeeper script = goScorer.GetComponent <scoreKeeper>(); GameObject parent = transform.parent.gameObject; script.Score(parent); Debug.Log("End"); } }
private void OnTriggerEnter2D(Collider2D collision) { Projectile Missle = collision.gameObject.GetComponent <Projectile>(); if (Missle) { health -= Missle.getDamage(); Missle.hit(); if (health < 0) { AudioSource.PlayClipAtPoint(death, transform.position); Destroy(gameObject); scoreKeeper.Score(scoreValue); } } }
void Die() { AudioSource.PlayClipAtPoint(deathSound, transform.position); Destroy(gameObject); scoreKeeper.Score(scoreValue); }