private void OnCollisionEnter2D(Collision2D collision) { firstBlockbool = FindObjectOfType <hotairballoon>(); if (!(collision.gameObject.tag == "baseBlock")) { //if its not baseblock // firstBlockbool.resize(); // firstBlockbool.collisonsubstracter(); birdsound.Play(); Destroy(collision.gameObject); Instantiate(birds, this.transform.position, this.transform.rotation); Destroy(gameObject); print("birdexplode"); firstBlockbool.updatelives(); } else { firstBlockbool.resize(); //firstBlockbool.collisonsubstracter(); firstBlockbool.birdfirstb(); Destroy(collision.gameObject); Instantiate(birds, this.transform.position, this.transform.rotation); Destroy(gameObject); firstBlockbool.updatelives(); } }
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); * * * } * } * } */ }