//enemy collider events void OnTriggerEnter2D(Collider2D coll) { Missile missile = coll.gameObject.GetComponent <Missile>(); //if enemy is hit by player missile if (missile) { //reduce enemy health by missile damage, if health after his is lower or equal than 0 destroy enemy health -= missile.getDamage(); missile.Hit(); if (health <= 0) { scoreKeeper.Score(pointValue); Destroy(gameObject); } } }