void OnCollisionEnter(Collision coll) { if (!mainManager.dead) { if (coll.gameObject.tag == "Obstacle") { mainManager.Die(); smokeParticles.Stop(); destroyParticles.Play(); //Debug.Log("BOOM"); } if (coll.gameObject.tag == "Coin") { mainManager.AddCoin(); Destroy(coll.gameObject); GameObject coinParticle; if (mainManager.GetComponent <MapManager>().jpMode) { coinParticle = jpCoinParticlePrefab; } else { coinParticle = coinParticlePrefab; } Instantiate(coinParticle, coll.transform.position, Quaternion.identity); //Debug.Log("Coin"); } } }