Beispiel #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        projectile missile = col.gameObject.GetComponent <projectile> ();

        if (missile)
        {
            health -= missile.getdamage();
            missile.hit();
            if (health <= 0)
            {
                Destroy(gameObject);
                LevelManager level = GameObject.Find("LevelManager").GetComponent <LevelManager>();
                level.LoadLevel("Lost");
            }
        }
    }
Beispiel #2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        projectile missile = col.gameObject.GetComponent <projectile> ();

        if (missile)
        {
            health -= missile.getdamage();
            missile.hit();
            if (health <= 0)
            {
                Destroy(gameObject);
                AudioSource.PlayClipAtPoint(death, transform.position);
                scorekeeper.scoreinc(scorevalue);
            }
        }
    }