void OnDestroy() { TripleRedShell parent = transform.root.gameObject.GetComponent <TripleRedShell>(); if (parent) { parent.Children.Remove(gameObject.GetComponent <RedShell>()); } if (CarCollCtl) { CarCollCtl.EnableCar(true); } if (itemMgr) { itemMgr.OnDefaultLaunch -= LaunchForward; } }
void OnTriggerEnter(Collider coll) { if (coll.gameObject.tag == "EnemyCollider") { TripleRedShell parent = transform.root.gameObject.GetComponent <TripleRedShell>(); if (parent) { parent.Children.Remove(gameObject.GetComponent <RedShell>()); } CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>(); CarCollCtl.HitItem(); ShowParticles(); Hide("Sphere"); Destroy(gameObject, duration); } if (coll.gameObject.tag == "LaunchableItem") { ShowParticles(); Destroy(coll.gameObject); Destroy(gameObject); } }