mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-07 20:27:13 +08:00
refactor(Statemachine): 替换Time.get_ticks_msec为WorldManager.getTime
统一使用WorldManager.getTime获取时间,提高代码一致性并便于未来时间管理逻辑的修改
This commit is contained in:
@@ -176,11 +176,11 @@ func useEnergy(value: float):
|
||||
energyChanged.emit(energy)
|
||||
return state
|
||||
func isCooldowned():
|
||||
return Time.get_ticks_msec() - lastAttack >= cooldownUnit / fields.get(FieldStore.Entity.ATTACK_SPEED)
|
||||
return WorldManager.getTime() - lastAttack >= cooldownUnit / fields.get(FieldStore.Entity.ATTACK_SPEED)
|
||||
func startCooldown():
|
||||
var state = isCooldowned()
|
||||
if state:
|
||||
lastAttack = Time.get_ticks_msec()
|
||||
lastAttack = WorldManager.getTime()
|
||||
return state
|
||||
func tryAttack(type: int):
|
||||
var state = startCooldown()
|
||||
|
||||
Reference in New Issue
Block a user