From 90fee56b0834d488268017c713dae96665b33bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sat, 6 Sep 2025 17:53:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96ColorBar=E7=9A=84?= =?UTF-8?q?=E5=89=8D=E6=99=AF=E5=80=BC=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Statemachine/ColorBar.gd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/Statemachine/ColorBar.gd b/scripts/Statemachine/ColorBar.gd index ebc6a35..af91984 100644 --- a/scripts/Statemachine/ColorBar.gd +++ b/scripts/Statemachine/ColorBar.gd @@ -37,7 +37,12 @@ func _draw(): draw_style_box(middleBox2 if forwardDirection > 0 else middleBox1, Rect2(0, 0, size.x * getPercent(middleValue), size.y)) draw_style_box(frontBox, Rect2(0, 0, size.x * getPercent(frontValue), size.y)) func _physics_process(_delta: float) -> void: - if WorldManager.getTime() - lastChangeTime > GameRule.detainTime: + if forwardDirection > 0: middleValue = lerpf(middleValue, currentValue, speed1 if forwardDirection > 0 else speed2) - frontValue = lerpf(frontValue, currentValue, speed1 if forwardDirection < 0 else speed2) + if WorldManager.getTime() - lastChangeTime > GameRule.detainTime: + frontValue = lerpf(frontValue, currentValue, speed1 if forwardDirection < 0 else speed2) + else: + if WorldManager.getTime() - lastChangeTime > GameRule.detainTime: + middleValue = lerpf(middleValue, currentValue, speed1 if forwardDirection > 0 else speed2) + frontValue = lerpf(frontValue, currentValue, speed1 if forwardDirection < 0 else speed2) queue_redraw()