Пример #1
0
 // Use this for initialization
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.CompareTag("Meteorite"))
     {
         MeteoriteController mc = collision.gameObject.GetComponent <MeteoriteController>();
         mc.BlowUp();
         ContactPoint2D contactPoint   = collision.contacts[0];
         Vector2        explosionPoint = contactPoint.point;
         Instantiate(explosion, explosionPoint, Quaternion.identity);
         if (particleExplosion != null)
         {
             Instantiate(particleExplosion, explosionPoint, Quaternion.identity);
         }
         MeteoriteController meteorite = collision.gameObject.GetComponent <MeteoriteController>();
         Destroy(gameObject);
     }
     if (collision.gameObject.CompareTag("Wall"))
     {
         Destroy(gameObject);
     }
 }
Пример #2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Meteorite"))
        {
            if (!godMode)
            {
                MeteoriteController meteorite = collision.gameObject.GetComponent <MeteoriteController>();
                meteorite.BlowUp();
                GameController gameController = GameObject.Find("GameManager").GetComponent <GameController>();

                if (gameController != null)
                {
                    gameController.StartMenuTimer();
                }

                BlowUp(collision);
                PlayExplosion();
                isDestroyed = true;
            }
        }
    }