示例#1
0
    void OnCollisionEnter2D(Collision2D myCollider)
    {
        //Take away health
        health--;
        count++;

        // if health is < 0 destroy brick
        if (health <= 0)
        {
            LevelManagerScript.brickCount--;
            levelManager.CheckBrickCount();
            Destroy(this.gameObject);
        }

        //change the picture
        GetComponent <SpriteRenderer>().sprite = picture[count];
    }