private void OnTriggerEnter2D(Collider2D collider) { if (this.gameObject.tag == "Flappy") { if (collider.gameObject.tag == "FireBall") { SoundControl.PopSound(); Destroy(this.gameObject); Destroy(collider.gameObject); healthandscore.GetFlappyScore(); GameObject go = Instantiate(deadEffectFlappy, this.gameObject.transform.position, this.gameObject.transform.rotation); Destroy(go.gameObject, 1f); } if (collider.gameObject.tag == "StopLeft") { Destroy(this.gameObject); } } if (this.gameObject.tag == "Lava") { if (collider.gameObject.tag == "floor") { Destroy(this.gameObject); } if (collider.gameObject.tag == "Player") { healthandscore.health -= 2; Destroy(this.gameObject); } } if (this.gameObject.tag == "Black" || this.gameObject.tag == "Purple") { if (collider.gameObject.tag == "Player") { healthandscore.health -= 1; Destroy(this.gameObject); ParticleEffect_BlueAndPurple(); } if (collider.gameObject.tag == "StopRight") { Destroy(this.gameObject); } if (collider.gameObject.tag == "FireBall") { SoundControl.PopSound(); Destroy(this.gameObject); Destroy(collider.gameObject); healthandscore.GetScore(); ParticleEffect_BlueAndPurple(); } } if (this.gameObject.tag == "Red" || this.gameObject.tag == "Green") { if (collider.gameObject.tag == "Player") { healthandscore.health -= 1; Destroy(this.gameObject); ParticleEffect_RedAndGreen(); } if (collider.gameObject.tag == "StopLeft") { Destroy(this.gameObject); } if (collider.gameObject.tag == "FireBall") { SoundControl.PopSound(); Destroy(this.gameObject); Destroy(collider.gameObject); healthandscore.GetScore(); ParticleEffect_RedAndGreen(); } } }