// Update is called once per frame void Update() { GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player != null && !shrinking && PlayerGG.GetInstance().state == PlayerGG.State.ALIVE && Mathf.Abs(transform.position.x - player.transform.position.x) < distance) { shrinking = true; StartCoroutine(Shrink()); } }
// Update is called once per frame void Update() { Rect rect = CameraMovement.CameraRect(); GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player != null && !shattering && PlayerGG.GetInstance().state == PlayerGG.State.ALIVE && (Mathf.Abs(transform.position.x - player.transform.position.x) < distance || transform.position.y > rect.yMax)) { shattering = true; StartCoroutine(Shatter()); } }