// Update is called once per frame void Update() { if (!outOfScreenDone) { if (OutOfScreen()) { GetComponent <AudioSource>().clip = fallRollSounds[Random.Range(0, fallRollSounds.Length)]; GetComponent <AudioSource>().Play(); Invoke("PoolObject", GetComponent <AudioSource>().clip.length); outOfScreenDone = true; } } if (isGolden) { if (Input.touchCount > 0) { Vector3 wp = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position); Vector2 touchPos = new Vector2(wp.x, wp.y); if (GetComponent <Collider2D>() == Physics2D.OverlapPoint(touchPos)) { parent.StartGoldenRoll(); ObjectPool.instance.PoolObject(gameObject); } } } }