void OnTriggerEnter2D(Collider2D col) { if (PS.gate) { PS.isMove = false; PS.gate = false; StartCoroutine(Rot1()); Player.transform.position = transform.position; PS.coll(); rgdy.velocity = new Vector3(0, 0, 0); } else if (!PS.gate) { PS.isMove = false; PS.gate = true; StartCoroutine(Rot2()); Player.transform.position = transform.position; PS.coll(); rgdy.velocity = new Vector3(0, 0, 0); } }
void OnTriggerEnter2D(Collider2D col) { if (rgdy.velocity.x > 14f || rgdy.velocity.x < -14f || rgdy.velocity.y > 14f || rgdy.velocity.y < -14f) { Destroy(gameObject); } else { PS.isMove = true; rgdy.velocity = new Vector2(0f, 0f); PS.coll(); } }