public void Duck() { if (controller.collisions.below && directionalInput.y == -1) { controller.CalculateRaySpacing(); if (boxCollider.offset == Vector2.zero) { boxCollider.offset = boxCollider.offset + Vector2.down * colliderHeight / 4; } boxCollider.size = new Vector2(boxCollider.size.x, colliderHeight * 0.5f); playerState.ducking = true; playerAnimation.Duck(playerState.ducking); } else if (controller.CeilingCheck() && !playerState.dashing) { controller.CalculateRaySpacing(); if (boxCollider.offset != Vector2.zero) { boxCollider.offset = Vector2.zero; } boxCollider.size = new Vector2(boxCollider.size.x, colliderHeight); if ((directionalInput.y != -1) || (playerState.jumping) || !controller.collisions.below) { boxCollider.size = new Vector2(boxCollider.size.x, colliderHeight); playerState.ducking = false; playerAnimation.Duck(playerState.ducking); } } }