mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 00:11:54 +08:00
refactor(CameraManager): 重构相机震动系统并添加强度参数
- 移除shaking布尔变量,改用shakeIntensity控制震动强度 - 修改shake方法接受强度参数,支持叠加震动效果 - 简化震动逻辑,移除调试打印语句 feat(ItemDropped): 添加物品自动收集功能 - 当物品与玩家距离小于60时自动收集并销毁 - 调用玩家collectItem方法处理收集逻辑 refactor(EntityBase): 重构物品收集逻辑 - 将物品收集逻辑从信号回调移至collectItem方法 - 移除itemCollected信号及相关UI更新代码 - 简化hurtbox连接逻辑 style(World): 调整动画资源顺序 - 交换两个动画资源的定义顺序
This commit is contained in:
@@ -7,8 +7,6 @@ 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,
|
||||
@@ -76,24 +74,11 @@ func _ready():
|
||||
if isPlayer():
|
||||
statebar.levelLabels.hide()
|
||||
UIState.player = self
|
||||
hurtbox.body_entered.connect(
|
||||
func(body):
|
||||
if body is ItemDropped:
|
||||
inventory[body.item] += body.stackCount
|
||||
playSound("collect")
|
||||
itemCollected.emit(body.item, body.stackCount)
|
||||
body.queue_free()
|
||||
)
|
||||
energyChanged.connect(
|
||||
func(newEnergy):
|
||||
UIState.energyPercent.maxValue = fields.get(FieldStore.Entity.MAX_ENERGY)
|
||||
UIState.energyPercent.setCurrent(newEnergy)
|
||||
)
|
||||
itemCollected.connect(
|
||||
func(itemType, amount):
|
||||
if MathTool.rate(GameRule.tipSpawnRateWhenGetDroppedItem):
|
||||
UIState.itemCollect.add_child(ItemShow.generate(itemType, amount, true))
|
||||
)
|
||||
else:
|
||||
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
|
||||
applyLevel()
|
||||
@@ -166,6 +151,9 @@ func takeDamage(bullet: BulletBase, crit: bool):
|
||||
bullet.launcher.storeEnergy(energy * 0.35)
|
||||
bullet.launcher.setBoss(null)
|
||||
tryDie(bullet)
|
||||
func collectItem(itemType: ItemStore.ItemType, amount: int):
|
||||
inventory[itemType] += amount
|
||||
playSound("collect")
|
||||
func storeEnergy(value: float):
|
||||
energy += value * fields.get(FieldStore.Entity.ENERGY_MULTIPILER)
|
||||
energyChanged.emit(energy)
|
||||
|
||||
Reference in New Issue
Block a user