1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-13 07:07:12 +08:00

refactor: 替换PresetAIs为PresetBulletAI,优化子弹AI逻辑

This commit is contained in:
2025-09-06 18:33:11 +08:00
parent b32f864e84
commit f5db5829a2
14 changed files with 36 additions and 15 deletions
+11
View File
@@ -15,3 +15,14 @@ static func percent(value: float):
return value / 100
static func shrimpRate(value: float):
return floor(value) + int(rate(value - floor(value)))
static func getClosestIntersection(a: Vector2, b: Vector2, r: float) -> Vector2:
var ab = b - a
var distance = ab.length()
if distance < 0.00001:
return a + Vector2.RIGHT * r
var abNormalized = ab / distance
var distanceB = distance
if distanceB <= r:
return b
var intersection = a + abNormalized * r
return intersection