feat: 创建 upgrade 数据resource,编写upgrade_panel.gd动态生成升级卡片
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://dfvsbd5jl31pt"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://byg3400qlcem6" path="res://assets/sprites/Upgrades/8.png" id="1_worpx"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="1_ynscf"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ynscf")
|
||||
value = 1.0
|
||||
descriptin = "+ 1%"
|
||||
stat_id = "block_chance"
|
||||
item_name = "Block"
|
||||
item_icon = ExtResource("1_worpx")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://htj45csm68fo"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dn68qq5evmvwa" path="res://assets/sprites/Upgrades/12.png" id="1_6nlt1"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="2_b4rq5"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_b4rq5")
|
||||
value = 1.0
|
||||
descriptin = "+ 1"
|
||||
stat_id = "damage"
|
||||
item_name = "Damage"
|
||||
item_icon = ExtResource("1_6nlt1")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://bwxjxrmg4hkfx"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://k3qfoarie5u0" path="res://assets/sprites/Upgrades/7.png" id="1_wtmxu"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="2_hlrix"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_hlrix")
|
||||
value = 1.0
|
||||
descriptin = "+ 1"
|
||||
stat_id = "harvesting"
|
||||
item_name = "Harvesting"
|
||||
item_icon = ExtResource("1_wtmxu")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://d2x2dbdfls585"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://513vy8yuf2c3" path="res://assets/sprites/Upgrades/6.png" id="1_x3r4g"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="2_fqyel"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_fqyel")
|
||||
value = 1.0
|
||||
descriptin = "+ 1"
|
||||
stat_id = "health"
|
||||
item_name = "Health"
|
||||
item_icon = ExtResource("1_x3r4g")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://3pjreo5epl8m"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ceccthrgto2um" path="res://assets/sprites/Upgrades/13.png" id="1_spl5c"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="2_8r7f1"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_8r7f1")
|
||||
value = 1.0
|
||||
descriptin = "+ 1"
|
||||
stat_id = "hp_regen"
|
||||
item_name = "HP Regen"
|
||||
item_icon = ExtResource("1_spl5c")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://cq276vsvx4uld"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dac1qxk0rktmg" path="res://assets/sprites/Upgrades/11.png" id="1_y6yk3"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="2_cmyrk"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_cmyrk")
|
||||
value = 5.0
|
||||
descriptin = "+ 5"
|
||||
stat_id = "speed"
|
||||
item_name = "Speed"
|
||||
item_icon = ExtResource("1_y6yk3")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://cgusn8qne4kjl"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dxl550mv1d5l6" path="res://assets/sprites/Upgrades/3.png" id="1_co2m3"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="2_qhb0c"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_qhb0c")
|
||||
value = 1.0
|
||||
descriptin = "+ 1%"
|
||||
stat_id = "life_steal"
|
||||
item_name = "Life Steal"
|
||||
item_icon = ExtResource("1_co2m3")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,14 @@
|
||||
[gd_resource type="Resource" script_class="ItemUpgrade" format=3 uid="uid://buvdtarq3qu2j"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dxl550mv1d5l6" path="res://assets/sprites/Upgrades/3.png" id="1_2jex5"]
|
||||
[ext_resource type="Script" uid="uid://ti87pqqmd7ro" path="res://resources/items/upgrades/item_upgrade.gd" id="2_dk47u"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_dk47u")
|
||||
value = 1.0
|
||||
descriptin = "+ 1%"
|
||||
stat_id = "life_steal"
|
||||
item_name = "Life Steal"
|
||||
item_icon = ExtResource("1_2jex5")
|
||||
item_type = 1
|
||||
metadata/_custom_type_script = "uid://ti87pqqmd7ro"
|
||||
@@ -0,0 +1,11 @@
|
||||
extends ItemBase
|
||||
class_name ItemUpgrade
|
||||
|
||||
@export var value: float
|
||||
@export var descriptin: String
|
||||
@export var stat_id: String
|
||||
|
||||
func apply_upgrade() -> void:
|
||||
var current_value := Global.player.stats.get(stat_id) as float
|
||||
var new_value := float(value) + float(current_value)
|
||||
Global.player.stats.set(stat_id, new_value)
|
||||
@@ -0,0 +1 @@
|
||||
uid://ti87pqqmd7ro
|
||||
Reference in New Issue
Block a user