mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-16 00:22:29 +08:00
feat(UI): 添加物品收集显示功能
- 新增CameraManager脚本用于相机管理 - 在UI场景中添加物品收集容器VBoxContainer - 扩展ItemShow类支持生成物品显示实例 - 修改EntityBase添加物品收集信号和处理逻辑 - 调整BossBar位置和布局属性
This commit is contained in:
@@ -7,6 +7,8 @@ signal healthChanged(health: float)
|
||||
|
||||
signal energyChanged(energy: float)
|
||||
|
||||
signal itemCollected(itemType: ItemStore.ItemType, amount: int)
|
||||
|
||||
var fields = {
|
||||
FieldStore.Entity.MAX_HEALTH: 100,
|
||||
FieldStore.Entity.DAMAGE_MULTIPILER: 1,
|
||||
@@ -72,6 +74,7 @@ func _ready():
|
||||
if body is ItemDropped:
|
||||
inventory[body.item] += body.stackCount
|
||||
playSound("collect")
|
||||
itemCollected.emit(body.item, body.stackCount)
|
||||
body.queue_free()
|
||||
)
|
||||
energyChanged.connect(
|
||||
@@ -79,6 +82,10 @@ func _ready():
|
||||
UIState.energyPercent.maxValue = fields.get(FieldStore.Entity.MAX_ENERGY)
|
||||
UIState.energyPercent.setCurrent(newEnergy)
|
||||
)
|
||||
itemCollected.connect(
|
||||
func(itemType, amount):
|
||||
UIState.itemCollect.add_child(ItemShow.generate(itemType, amount))
|
||||
)
|
||||
else:
|
||||
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
|
||||
healthChanged.emit(health)
|
||||
|
||||
Reference in New Issue
Block a user