public void FireAndExplode() { Rigidbody shellInstance = Instantiate(m_Shell, m_FireTransform.position, m_FireTransform.rotation) as Rigidbody; ShellExplosion shellExplosion = shellInstance.GetComponent <ShellExplosion>(); shellExplosion.Explode(15.0f); }
private void BlowUp() { ShellExplosion currentExplosion = Instantiate(explosion, transform.position, Quaternion.identity); currentExplosion.Explode(explosionForce, explosionRadius); Destroy(currentExplosion.gameObject, 3f); Destroy(gameObject); }
private void OnCollisionEnter(Collision collision) { ParticleSystem particles = GetComponentInChildren <ParticleSystem>(); particles.transform.parent = null; Destroy(particles.gameObject, 1f); ShellExplosion currentExplosion = Instantiate(explosion, transform.position, Quaternion.identity); Destroy(currentExplosion.gameObject, 3f); currentExplosion.Explode(explosionForce, explosionRadius); Destroy(gameObject); }
private void OnCollisionEnter(Collision collision) { Rigidbody rb = collision.gameObject.GetComponent <Rigidbody>(); if (collision.gameObject.GetComponent <Rigidbody>() != null) { if (rb.velocity.magnitude + velocity > forceToExplode) { ShellExplosion currentExplosion = Instantiate(explosion, transform.position, transform.rotation); currentExplosion.Explode(explosionForce, explosionRadius); Destroy(currentExplosion.gameObject, 5f); Destroy(gameObject); } } }
private void OnCollisionEnter(Collision collision) { if (ai != null) { ai.SetProjectileTime(totalFlightTime); } ShellExplosion thisExplosion = Instantiate(explosion, explosionPoint.position, explosionPoint.rotation); Destroy(thisExplosion.gameObject, 5f); if (ai != null) { thisExplosion.SetExplosionFromAI(); } thisExplosion.Explode(explosionForce, explosionRadius); Destroy(gameObject); }