Beispiel #1
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Ship")
     {
         effectSpawner.AsteroidsBlowingUp(collision.gameObject.transform.position, effectSpawner.playerExplosion, 1);
         Destroy(collision.gameObject);
         FindObjectOfType <LevelManager>().OnPlayerDeath();
         DestroyBullet();
     }
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Bullet")
        {
            Destroy(collision.gameObject);

            Destroy(gameObject);

            levelManager.IncreaseScore(scoreValue);

            effectSpawner.AsteroidsBlowingUp(transform.position, effectSpawner.mediumAsteroidExplosion, 0);
        }

        // CHANGE THIS!
        if (collision.gameObject.tag == "Ship")
        {
            effectSpawner.AsteroidsBlowingUp(collision.gameObject.transform.position, effectSpawner.playerExplosion, 1);
            Destroy(collision.gameObject);
            FindObjectOfType <LevelManager>().OnPlayerDeath();
        }
    }