mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
3698127345
实现草墙障碍物系统,包括以下主要变更: - 新增草墙障碍物资源、脚本和场景 - 添加障碍物状态显示UI - 扩展组件管理器支持障碍物类型 - 修改子弹系统以支持对障碍物的碰撞检测 - 调整实体碰撞层设置 - 为公鸡角色添加草墙武器 新增功能允许玩家放置可阻挡敌人的草墙障碍物,并显示其生命值状态
18 lines
499 B
GDScript
18 lines
499 B
GDScript
extends Node2D
|
|
class_name ObstacleStateBar
|
|
|
|
@export var obstacle: ObstacleBase
|
|
|
|
@onready var healthBar: ColorBar = $%health
|
|
@onready var currentLabel: Label = $%current
|
|
@onready var maxLabel: Label = $%max
|
|
@onready var levelLabelContainer: HBoxContainer = $%levelLabel
|
|
|
|
func forceSync():
|
|
healthBar.maxValue = obstacle.healthMax
|
|
healthBar.currentValue = obstacle.health
|
|
healthBar.forceSync()
|
|
func applyText():
|
|
currentLabel.text = "%d" % obstacle.health
|
|
maxLabel.text = "%d" % obstacle.healthMax
|