tool extends Sprite class_name ElixirsSprite # 药水颜色 enum ElixirsColor { Red,Blue,Gold } export(ElixirsColor) var elixirs_color = ElixirsColor.Red setget set_elixirs_color # 药剂回升血量 export var elixirs_value : int = 100 # 默认数据初始化 func _init(): self.texture = load("res://images/mota.png") self.region_enabled = true func set_elixirs_color(value): elixirs_color = value match value: ElixirsColor.Red: region_rect = Rect2(96,416,32,32) ElixirsColor.Blue: region_rect = Rect2(128,416,32,32) ElixirsColor.Gold: region_rect = Rect2(160,416,32,32) func _on_Area2D_body_entered(body): GameArchiveManager.player_info.hp += elixirs_value $"/root/Main/UI/HpSprite/HpBackground/HpLabel".text = GameArchiveManager.player_info.hp as String GameArchiveManager.add_used_item(get_path()) queue_free()