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

refactor: 使用ComponentManager统一管理资源加载

将所有直接使用`load("res://components/...")`加载资源的代码替换为通过`ComponentManager`统一管理的方式,提高代码的可维护性和资源管理的统一性
This commit is contained in:
2025-09-21 13:11:31 +08:00
parent e688f7f0c1
commit e551a6db61
17 changed files with 44 additions and 44 deletions
+4 -4
View File
@@ -26,19 +26,19 @@ func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
for i in randi_range(10, 20):
BulletBase.generate(load("res://components/Bullets/Diamond.tscn"), self, weaponPos + MathTool.randv2_range(20), rotation + deg_to_rad(randf_range(-90, 90)))
BulletBase.generate(ComponentManager.getBullet("Diamond"), self, weaponPos + MathTool.randv2_range(20), rotation + deg_to_rad(randf_range(-90, 90)))
elif type == 1:
var laserCount = randi_range(2, 4)
for i in laserCount:
BulletBase.generate(load("res://components/Bullets/ChickLaser.tscn"), self, texture.global_position, deg_to_rad(360.0 / laserCount * i))
BulletBase.generate(ComponentManager.getBullet("ChickLaser"), self, texture.global_position, deg_to_rad(360.0 / laserCount * i))
elif type == 2:
var weaponPos = findWeaponAnchor("normal")
var target = weaponPos.angle_to_point(currentFocusedBoss.position)
firepot.global_rotation = target
firepot.shot()
BulletBase.generate(load("res://components/Bullets/FireScan.tscn"), self, weaponPos, target)
BulletBase.generate(ComponentManager.getBullet("FireScan"), self, weaponPos, target)
elif type == 3:
BulletBase.generate(load("res://components/Bullets/ChickSprint.tscn"), self, position, 0)
BulletBase.generate(ComponentManager.getBullet("ChickSprint"), self, position, 0)
trySprint()
return true
func sprint():