Ave all
I got method from lecture:
void OnTriggerEnter2D(Collider2D collider){
Projectile missile = collider.gameObject.GetComponent();
if (missile) {
hitPoints -= missile.GetDamage();
missile.Hit();
if (hitPoints <= 0) {
Destroy(gameObject);
scoreKeeper.ScorePoints(scoreValue);
}
}
}
And i’m not sure how last line work:
scoreKeeper.ScorePoints(scoreValue);
In pass score to scorekeeper script (scoreKeeper = GameObject.Find(“ScorePoints”).GetComponent()
?