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

refactor(子弹系统): 将子弹前进逻辑提取到PresetsAI类中

将多个子弹类型的forward调用统一到PresetsAI类中,提高代码复用性
删除LockLauncher.gd文件及部分场景文件中冗余的fields配置
This commit is contained in:
2025-08-29 10:56:33 +08:00
parent 171dbb1131
commit 187100f500
11 changed files with 8 additions and 44 deletions
@@ -1,16 +0,0 @@
extends BulletBase
class_name LockLauncher
enum PositionType {
SELF,
TEXTURE,
}
@export var target: PositionType = PositionType.SELF
func ai():
if target == PositionType.SELF:
position = launcher.position
else:
position = launcher.texture.global_position
rotation = launcher.rotation
+1 -1
View File
@@ -8,4 +8,4 @@ func register():
func ai():
rotation = lerp_angle(rotation, position.angle_to_point(launcher.currentFocusedBoss.position), 0.1 * clamp((traceTime - timeLived()) / traceTime, 0, INF))
canDamageSelf = !(timeLived() >= traceTime)
forward(Vector2.from_angle(rotation))
PresetsAI.forward(self, rotation)
+1 -1
View File
@@ -6,4 +6,4 @@ func register():
damage = 20
func ai():
forward(Vector2.from_angle(rotation))
PresetsAI.forward(self, rotation)
@@ -0,0 +1,4 @@
class_name PresetsAI
static func forward(bullet: BulletBase, rotation: float):
bullet.forward(Vector2.from_angle(rotation))
+1 -1
View File
@@ -2,4 +2,4 @@ extends BulletBase
class_name PurpleCrystal
func ai():
forward(Vector2.from_angle(rotation))
PresetsAI.forward(self, rotation)
+1 -1
View File
@@ -4,4 +4,4 @@ class_name Star
func register():
damage = 1
func ai():
forward(Vector2.from_angle(rotation))
PresetsAI.forward(self, rotation)