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

feat(Statemachine): 添加获取周期计时器方法并增强子弹过滤逻辑

为EntityBase添加getCycleTimer方法以直接获取计时器
修改CycleTimer的forceFilter方法以检查子弹是否正在销毁
更新InfinitySword的hitBullet逻辑以处理内部伤害子弹
This commit is contained in:
2026-05-10 13:17:00 +08:00
parent 8f90bde510
commit 6e0d0ad89b
3 changed files with 15 additions and 2 deletions
+7 -1
View File
@@ -15,7 +15,13 @@ func lifetime():
func getStateAngle(index: int):
return lifetime() / period * deg_to_rad(360) - deg_to_rad(360.0 * index / len(bullets))
func forceFilter():
bullets = bullets.filter(is_instance_valid)
bullets = bullets.filter(
func(b):
if b is BulletBase:
return !b.destroying
else:
return false
)
func apply(where: Vector2):
forceFilter()
for index in len(bullets):
+2
View File
@@ -227,6 +227,8 @@ func getOrCreateCycleTimer(timerName: String, period: float = 1000, distance: fl
if start: newTimer.start()
cycleTimers[timerName] = newTimer
return cycleTimers[timerName]
func getCycleTimer(timerName: String):
return cycleTimers.get(timerName)
func initHealth(maxHealth: float):
fields[FieldStore.Entity.MAX_HEALTH] = maxHealth
health = maxHealth