Example #1
0
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.tag == "block")
        {
            blocksDestroyed += 1;
            Instantiate(destroyedblock, col.gameObject.transform.position, Quaternion.identity);

            destroyedblock.transform.localScale = Vector3.one * 0.3f;

            Destroy(col.gameObject);
            if (blocksDestroyed >= 16)
            {
                gameManager.uWin();
            }
        }
        if (col.gameObject.tag == "Destroyer")
        {
            gameManager.GameOver();
            Destroy(gameObject);
        }
    }