private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.name.Contains("powerup")) { if (health < 4) { health++; healthDisplay.AddOneToHealth(); powerUpAudio.Play(); Destroy(collision.gameObject); } return; } health--; if (health <= 0) { GameObject.Find("GameController").GetComponent <GameSceneController>().StopAllCoroutines(); Instantiate(explosion, transform.position, Quaternion.identity); GameObject.Find("GameController").GetComponent <GameSceneController>().StartBtn.SetActive(true); Destroy(this.gameObject); } else { //Play shield effect GameObject s = Instantiate(shieldAnimation, transform.position, Quaternion.identity); s.transform.SetParent(this.gameObject.transform); Destroy(s, .25f); //update display healthDisplay.removeOneFromHealth(); //play random sound shieldHit1Audio.Play(); } }