Esempio n. 1
0
    private void OnCollisionEnter2D(Collision2D collision)

    {
        print("Collided");

        print(collision.gameObject.tag + "ayush");

        if (!(collision.gameObject.tag == "baseBlock"))//if its not baseblock
        {
            firstBlockbool.counterblocks1();

            //firstBlockbool.resize();
            //firstBlockbool.collisonsubstracter();
            Destroy(collision.gameObject);
            explode.Play();
            firstBlockbool.updatelives();
            print("explode");
        }
        else
        {
            // firstBlockbool.counterblockl1();
            // firstBlockbool.resize();
            //firstBlockbool.collisonsubstracter();
            firstBlockbool.birdfirstb();
            explode.Play();
            firstBlockbool.updatelives();
            Destroy(collision.gameObject);
        }

        /*
         * {
         *
         *    if (collision.gameObject.CompareTag("ground"))
         *    {
         *        print(a + " " + b);
         *        a = a * (4f / 3f);
         *        b = b * (4f / 3f);
         *        Destroy(this.gameObject);
         *
         *
         *    }
         *    if (!collision.gameObject.CompareTag("ground"))
         *    {
         *        if (buildingBlockNew.transform.localScale.x != collision.transform.localScale.x * (3f / 4f))
         *        {
         *
         *            //  print("abc");
         *
         *            Destroy(this.gameObject);
         *
         *
         *        }
         *    }
         * }
         */
    }
Esempio n. 2
0
    private void OnCollisionEnter2D(Collision2D collision)

    {
        firstBlockbool = FindObjectOfType <hotairballoon>();
        // firstBlockbool.collisonadder();
        //if (this.transform.localScale.x == collision.transform.localScale.x )//* (3.75f / 4f))
        print("ayushcc");

        if (collision.gameObject.tag == "buildingBlock")

        {
            firstBlockbool.counterblockl1();
            if (SceneManager.GetActiveScene().name == "Start")
            {
                if (collision.transform.localScale.x >= -0.01004417)
                {
                    print("ayushccd");

                    firstBlockbool.checkwin();
                }
            }
            if (SceneManager.GetActiveScene().name == "level 2")
            {
                print("ayushccd");
            }
            {
                if (collision.transform.localScale.x >= -0.01576463)
                {
                    firstBlockbool.checkwin();
                }
            }
            if (SceneManager.GetActiveScene().name == "level3")
            {
                print("ayushccd");
            }
            {
                if (collision.transform.localScale.x >= -0.0137034)
                {
                    firstBlockbool.checkwin();
                }
            }



            if (collision.transform.tag == "ground")

            {
                firstBlockbool.counterblocks1();
            }
        }
    }