void OnTriggerExit2D(Collider2D col) { if (col.tag == "Player") { if (inScoreBox) { SpriteScore.AddPoint(); inScoreBox = false; audio.Play(); } } }
void Start() { instanceScore = this; GameObject player_GO = GameObject.FindGameObjectWithTag("Player"); if (player_GO == null) { Debug.LogError("Could not find a GameObject with tag 'Player'."); } theBird = player_GO.GetComponent <RigidBodyJumpScript> (); score = 0; highScore = PlayerPrefs.GetInt("HighScore", 0); }
void OnDestroy() { instanceScore = null; PlayerPrefs.SetInt("HighScore", highScore); }