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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user