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

feat(ComponentManager): 实现组件管理器并初始化子弹资源

refactor(DirTool): 添加获取无扩展名文件名的方法
feat(WorldManager): 初始化ComponentManager

新增多个子弹资源文件并移动至统一目录
包括ForeverRainbow、ArrowSeven、SunDance、HeavyCrystal和LightGun
This commit is contained in:
2025-09-21 13:05:20 +08:00
parent 4c5842fb9e
commit e688f7f0c1
8 changed files with 20 additions and 1 deletions
+17 -1
View File
@@ -1,3 +1,19 @@
class_name ComponentManager
var store = {}
static var bullets = {}
static var characters = {}
static var effects = {}
static func init():
for i in DirTool.listdir("res://components/Bullets"):
bullets[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Characters"):
characters[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Effects"):
effects[DirTool.getBasenameWithoutExtension(i)] = load(i)
static func getBullet(name: String):
return bullets[name]
static func getCharacter(name: String):
return characters[name]
static func getEffect(name: String):
return effects[name]
+1
View File
@@ -8,6 +8,7 @@ static var runningTime: int = 0
func _ready():
tree = get_tree()
rootNode = self
ComponentManager.init()
func _physics_process(delta):
runningTime += delta * 1000
if EntityBase.mobCount() == 0 and runningTime > 3000: