void OnCollisionEnter(Collision coll) { if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Enemy") { CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>(); if (!CarCollCtl) { return; } CarCollCtl.HitItem(); Hide("Sphere"); Destroy(gameObject, duration); return; } if (coll.gameObject.tag == "LaunchableItem") { Destroy(coll.gameObject); Destroy(gameObject); } if (coll.collider.CompareTag("Wall") && isLaunch) { ShowParticles(); Destroy(gameObject); } }
void OnTriggerEnter(Collider coll) { CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>(); if (!CarCollCtl) { return; } CarCollCtl.HitItem(); Hide("Box"); Destroy(gameObject, duration); }
void OnDestroy() { if (CarCollCtl) { CarCollCtl.EnableCar(true); } if (itemMgr) { itemMgr.OnDefaultLaunch -= LaunchBackward; } }
void OnTriggerEnter(Collider coll) { CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>(); if (!CarCollCtl) { return; } CarCollCtl.HitItem(); target = coll.gameObject.transform.root.gameObject; Hide("Capsule"); Destroy(gameObject, duration); }
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 OnCollisionEnter(Collision coll) { if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Enemy") { CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>(); if (!CarCollCtl) { return; } CarCollCtl.HitItem(); ShowParticles(); Hide("Sphere"); Destroy(gameObject, duration); } if (coll.gameObject.tag == "LaunchableItem") { ShowParticles(); Destroy(coll.gameObject); Destroy(gameObject); } if (coll.collider.CompareTag("Wall") && isLaunch) { Debug.Log(transform.eulerAngles); foreach (ContactPoint contact in coll.contacts) { Vector3 reflectDir = Vector3.Reflect(transform.forward, contact.normal); transform.LookAt(reflectDir + transform.position); } rebound += 1; if (rebound >= maxRebound) { ShowParticles(); Destroy(gameObject); } else { GetComponent <AudioSource>().Play(); } } }
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); } }