Exemple #1
0
    private void OnCollisionEnter(Collision collision)
    {
        GameObject particle;

        if (collision.gameObject.CompareTag("Stone"))
        {
            particle = PoolObject.GetObject(Globals.PoolKey.VFXStone);
            particle.transform.position = transform.position;
        }

        if (collision.gameObject.CompareTag("Metal"))
        {
            particle = PoolObject.GetObject(Globals.PoolKey.VFXMetal);
            particle.transform.position = transform.position;
            particle.transform.rotation = Quaternion.FromToRotation(Vector3.up, collision.contacts[0].normal);;
        }

        if (collision.gameObject.CompareTag("Ground"))
        {
            particle = PoolObject.GetObject(Globals.PoolKey.VFXSend);
            particle.transform.position = transform.position;
        }

        if (collision.gameObject.CompareTag("Glass"))
        {
            TriangleExplosion explosion = collision.gameObject.GetComponent <TriangleExplosion>();
            explosion.StartCoroutine(explosion.SplitMesh(false));
        }
        StopCoroutine(BulletLifeTime());
        gameObject.SetActive(false);
    }
Exemple #2
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.impulse.magnitude > collisionMagnitude)
     {
         explosion.StartCoroutine("SplitMesh");
     }
 }