From 857a224f6f46e6b0ff0d295a08fce3d8c97cd74c 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: Thu, 28 Aug 2025 07:50:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor(Statemachine):=20=E4=BD=BF=E7=94=A8Gam?= =?UTF-8?q?eRule=E9=85=8D=E7=BD=AE=E7=89=A9=E5=93=81=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=81=9C=E7=95=99=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将ItemShow中的硬编码等待时间改为使用GameRule.itemShowStayTime配置 --- scripts/Statemachine/ItemShow.gd | 2 +- scripts/Tools/GameRule.gd | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Statemachine/ItemShow.gd b/scripts/Statemachine/ItemShow.gd index 3ca74fb..ed3e206 100644 --- a/scripts/Statemachine/ItemShow.gd +++ b/scripts/Statemachine/ItemShow.gd @@ -12,7 +12,7 @@ class_name ItemShow func _ready(): if autoFree: - await TickTool.millseconds(2000) # 等待1秒后自动隐藏 + await TickTool.millseconds(GameRule.itemShowStayTime) # 等待几秒后自动隐藏 animator.play("hide") await animator.animation_finished queue_free() diff --git a/scripts/Tools/GameRule.gd b/scripts/Tools/GameRule.gd index 8884305..5998ecc 100644 --- a/scripts/Tools/GameRule.gd +++ b/scripts/Tools/GameRule.gd @@ -7,4 +7,5 @@ static var damageLabelSpawnOffset: float = 10 # 伤害标签生成位置的随 static var itemDroppedSpawnOffset: float = 30 # 掉落物生成位置的随机偏移 static var appleDropRate: float = 0.1 # 苹果掉落概率 static var refreshCountIncreasePercent: Vector2 = Vector2(0.4, 1.1) # 刷新所需的棒球数量的增加的百分比,随机,默认为40%~110% -static var entityCountBoostPerWave: float = 0.1 # 每波敌人数量增加的百分比,倍数级 \ No newline at end of file +static var entityCountBoostPerWave: float = 0.1 # 每波敌人数量增加的百分比,倍数级 +static var itemShowStayTime: int = 1500 # 物品展示组件如果设置了自动隐藏,那么隐藏前可以存活的时间 \ No newline at end of file