Beispiel #1
0
    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);
    }
Beispiel #2
0
    private void BlowUp()
    {
        ShellExplosion currentExplosion = Instantiate(explosion, transform.position, Quaternion.identity);

        currentExplosion.Explode(explosionForce, explosionRadius);
        Destroy(currentExplosion.gameObject, 3f);
        Destroy(gameObject);
    }
Beispiel #3
0
    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);
    }
Beispiel #4
0
    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);
            }
        }
    }
Beispiel #5
0
    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);
    }