mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(武器系统): 添加武器资源管理并在非调试版本中初始化紫色水晶武器
在ComponentManager中添加武器资源管理功能,支持从指定目录加载武器资源 对于非调试版本的游戏,自动为玩家初始化紫色水晶武器
This commit is contained in:
@@ -122,6 +122,10 @@ func _ready():
|
||||
if isPlayer():
|
||||
if displayName == MultiplayerState.playerName:
|
||||
UIState.player = self
|
||||
if !OS.is_debug_build():
|
||||
for i in weaponStore.get_children():
|
||||
i.free()
|
||||
weaponStore.add_child(ComponentManager.getWeapon("PurpleCrystal").instantiate())
|
||||
for i in weaponStore.get_children():
|
||||
i.hide()
|
||||
weapons.append(i)
|
||||
|
||||
@@ -4,6 +4,7 @@ class_name ComponentManager
|
||||
|
||||
static var bullets = {}
|
||||
static var characters = {}
|
||||
static var weapons = {}
|
||||
static var summons = {}
|
||||
static var effects = {}
|
||||
static var feeds = []
|
||||
@@ -17,6 +18,8 @@ static func init():
|
||||
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/Weapons"):
|
||||
weapons[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Summons"):
|
||||
summons[DirTool.getBasenameWithoutExtension(i)] = load(i)
|
||||
for i in DirTool.listdir("res://components/Effects"):
|
||||
@@ -35,6 +38,8 @@ static func getBullet(t: String) -> PackedScene:
|
||||
return MathTool.priority(bullets.get(t, false), load("res://components/Bullets/%s.tscn" % t))
|
||||
static func getCharacter(t: String) -> PackedScene:
|
||||
return MathTool.priority(characters.get(t, false), load("res://components/Characters/%s.tscn" % t))
|
||||
static func getWeapon(t: String) -> PackedScene:
|
||||
return MathTool.priority(weapons.get(t, false), load("res://components/Weapons/%s.tscn" % t))
|
||||
static func getSummon(t: String) -> PackedScene:
|
||||
return MathTool.priority(summons.get(t, false), load("res://components/Summons/%s.tscn" % t))
|
||||
static func getEffect(t: String) -> PackedScene:
|
||||
|
||||
Reference in New Issue
Block a user