// // commented Debug.Log ("yep, excluding:" +excludeRootFromRocketExplosion); public static void MakeRocketExplosion(NumberInfo ni, Vector3 pos, Transform excludeRootFromRocketExplosion = null) { // AudioManager.inst.PlayExplosion1(pos); GameObject rocketAOE = (GameObject)GameObject.Instantiate(EffectsManager.inst.rocketAOE, pos, Quaternion.identity); RocketExplosionEffect aoe = rocketAOE.GetComponent <RocketExplosionEffect>(); aoe.myNi = ni; // a bit roundabout if (excludeRootFromRocketExplosion != null) { aoe.excludeRootFromRocketExplosion = excludeRootFromRocketExplosion; } // aoe.rocketValue = num; }
void OnCollisionEnter(Collision hit) { // // commented Debug.Log("hit and exp:"+hit.collider.name); if (hit.collider.transform.root == excludeRootFromRocketExplosion) { // // commented Debug.Log("don't collide with this"); return; } if (used) { return; } used = true; Collider other = hit.collider; gameObject.SendMessage("OnExplode", SendMessageOptions.DontRequireReceiver); // // commented Debug.Log("collision! from "+name+", col time:"+Time.time); RocketExplosionEffect.MakeRocketExplosion(GetComponent <NumberInfo>(), transform.position, excludeRootFromRocketExplosion); smokeTrail.transform.parent = null; smokeTrail.GetComponent <ParticleSystem>().emissionRate = 0; Destroy(gameObject); }