void OnCollisionEnter2D(Collision2D coll) { //if hit by an enemy bullet take 10 damage if (coll.gameObject.tag == "Dangerous") { pStats.takeDamage(10f); } if (coll.gameObject.tag == "Enemy") { audio.PlayOneShot(hitSound); } //when the end of level is reached if (coll.gameObject.tag == "Finish") { int score = pStats.point(); // an int with the player score pStats.saveCurrentScore(levelName, score); // save the current score with the key of the current levels name } }