1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

refactor(Statemachine): 替换Time.get_ticks_msec为WorldManager.getTime

统一使用WorldManager.getTime获取时间,提高代码一致性并便于未来时间管理逻辑的修改
This commit is contained in:
2025-08-29 10:27:32 +08:00
parent 506f0b0924
commit c322e3b796
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -27,7 +27,7 @@ var spawnInWhere: Vector2 = Vector2.ZERO
func _ready():
area_entered.connect(hit)
spawnInWhen = Time.get_ticks_msec()
spawnInWhen = WorldManager.getTime()
spawnInWhere = position
spawn()
dotLoop()
@@ -40,7 +40,7 @@ func _ready():
animator.play("loop")
func _process(_delta: float) -> void:
if lifeTime > 0:
if Time.get_ticks_msec() - spawnInWhen >= lifeTime:
if WorldManager.getTime() - spawnInWhen >= lifeTime:
destroy()
if lifeDistance > 0:
if position.distance_to(spawnInWhere) >= lifeDistance:
@@ -67,7 +67,7 @@ func forward(direction: Vector2):
func fullPenerate():
return fields.get(FieldStore.Bullet.PENERATE) + launcher.fields.get(FieldStore.Entity.PENERATE) + GameRule.penerateRateInfluenceByLuckValue * launcher.fields[FieldStore.Entity.LUCK_VALUE]
func timeLived():
return Time.get_ticks_msec() - spawnInWhen
return WorldManager.getTime() - spawnInWhen
func dotLoop():
if await applyDot():
await dotLoop()