mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat: 添加掉落物功能,更新饲料和物品显示,重构相关UI组件
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bykwevnv7keeh"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bykwevnv7keeh"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Structs/Feed.gd" id="1_2ea75"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="2_b6x2s"]
|
||||
[ext_resource type="Theme" uid="uid://dhvs6urgf6jr5" path="res://themes/main.tres" id="2_lvrpo"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"]
|
||||
content_margin_left = 30.0
|
||||
@@ -29,6 +30,12 @@ script = ExtResource("1_2ea75")
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="selectBtn" type="Button" parent="container"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_lvrpo")
|
||||
text = "确定"
|
||||
|
||||
[node name="info" type="VBoxContainer" parent="container"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://d3qojeqa3difn"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/FullscreenPanelBase.gd" id="1_8e8nf"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mjt0u"]
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_76r7u"]
|
||||
length = 0.001
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate:a")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:position:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xdama"]
|
||||
resource_name = "show"
|
||||
length = 0.5
|
||||
step = 0.1
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate:a")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:position:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, -500, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_kd0tm"]
|
||||
resource_name = "show"
|
||||
length = 0.5
|
||||
step = 0.1
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate:a")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:position:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(-500, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.5)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ocj0r"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_76r7u"),
|
||||
"hide": SubResource("Animation_xdama"),
|
||||
"show": SubResource("Animation_kd0tm")
|
||||
}
|
||||
|
||||
[node name="FullscreenPanelBase" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_8e8nf")
|
||||
|
||||
[node name="content" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_mjt0u")
|
||||
|
||||
[node name="wrapper" type="VBoxContainer" parent="content"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="animator" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_ocj0r")
|
||||
}
|
||||
@@ -34,6 +34,8 @@ animations = [{
|
||||
script = ExtResource("2_r6bub")
|
||||
cooldownUnit = 200.0
|
||||
displayName = "小鸡"
|
||||
drops = Array[int]([0, 1])
|
||||
dropCounts = Array[Vector2]([Vector2(10, 20), Vector2(7, 14)])
|
||||
|
||||
[node name="hurt" parent="sounds" index="2"]
|
||||
stream = ExtResource("3_ik1xf")
|
||||
|
||||
@@ -34,6 +34,8 @@ radius = 40.0
|
||||
[node name="Hen" instance=ExtResource("1_twxai")]
|
||||
script = ExtResource("2_8u5a0")
|
||||
cooldownUnit = 500.0
|
||||
drops = Array[int]([0, 1])
|
||||
dropCounts = Array[Vector2]([Vector2(4, 8), Vector2(2, 6)])
|
||||
|
||||
[node name="hurt" parent="sounds" index="2"]
|
||||
stream = ExtResource("3_ojyt7")
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://1n28ji5sl6bx"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d3qojeqa3difn" path="res://components/Abstracts/FullscreenPanelBase.tscn" id="1_1wmro"]
|
||||
[ext_resource type="PackedScene" uid="uid://bykwevnv7keeh" path="res://components/Abstracts/FeedCardBase.tscn" id="2_ae402"]
|
||||
|
||||
[node name="MakeFeed" instance=ExtResource("1_1wmro")]
|
||||
|
||||
[node name="wrapper" parent="content" index="0"]
|
||||
theme_override_constants/separation = 50
|
||||
|
||||
[node name="tips" type="VBoxContainer" parent="content/wrapper" index="0"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="title" type="RichTextLabel" parent="content/wrapper/tips" index="0"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme_override_font_sizes/bold_font_size = 30
|
||||
bbcode_enabled = true
|
||||
text = "[b]天降鸡饲料[/b]"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="tip" type="HBoxContainer" parent="content/wrapper/tips" index="1"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="select" type="RichTextLabel" parent="content/wrapper/tips/tip" index="0"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
bbcode_enabled = true
|
||||
text = "可选择"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="count" type="RichTextLabel" parent="content/wrapper/tips/tip" index="1"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
bbcode_enabled = true
|
||||
text = "1"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="feed" type="RichTextLabel" parent="content/wrapper/tips/tip" index="2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
bbcode_enabled = true
|
||||
text = "项增益"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="feedcards" type="HBoxContainer" parent="content/wrapper" index="1"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 30
|
||||
alignment = 1
|
||||
|
||||
[node name="FeedCard" parent="content/wrapper/feedcards" index="0" instance=ExtResource("2_ae402")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FeedCard2" parent="content/wrapper/feedcards" index="1" instance=ExtResource("2_ae402")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FeedCard3" parent="content/wrapper/feedcards" index="2" instance=ExtResource("2_ae402")]
|
||||
layout_mode = 2
|
||||
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dfwg750a47ggx"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dfwg750a47ggx"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ofpg5s3j7esv" path="res://components/UI/BossBar.tscn" id="1_2pe58"]
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/UIState.gd" id="1_f00a6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbm8l3hr4ihar" path="res://components/UI/ItemShow.tscn" id="3_o2oi4"]
|
||||
[ext_resource type="PackedScene" uid="uid://1n28ji5sl6bx" path="res://components/Scenes/FullscreenPanels/MakeFeed.tscn" id="4_kkki3"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xmgs2"]
|
||||
content_margin_left = 10.0
|
||||
@@ -49,9 +50,23 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_xmgs2")
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="ItemShow" parent="root/items/container" instance=ExtResource("3_o2oi4")]
|
||||
[node name="baseball" parent="root/items/container" instance=ExtResource("3_o2oi4")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemShow2" parent="root/items/container" instance=ExtResource("3_o2oi4")]
|
||||
[node name="basketball" parent="root/items/container" instance=ExtResource("3_o2oi4")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
type = 1
|
||||
|
||||
[node name="fullscreenPanels" type="Control" parent="root"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MakeFeed" parent="root/fullscreenPanels" instance=ExtResource("4_kkki3")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ar00p"]
|
||||
content_margin_left = 10.0
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_55nrw"]
|
||||
font_size = 14
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_esyuk"]
|
||||
font_size = 12
|
||||
font_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="BossBar" type="Control"]
|
||||
@@ -48,16 +48,19 @@ layout_mode = 2
|
||||
[node name="name" type="Label" parent="health/panel/label"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
text = "BossName"
|
||||
label_settings = SubResource("LabelSettings_55nrw")
|
||||
label_settings = SubResource("LabelSettings_esyuk")
|
||||
|
||||
[node name="value" type="Label" parent="health/panel/label"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
text = "percent"
|
||||
label_settings = SubResource("LabelSettings_55nrw")
|
||||
label_settings = SubResource("LabelSettings_esyuk")
|
||||
|
||||
[node name="percent" type="Label" parent="health/panel/label"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
text = "%"
|
||||
label_settings = SubResource("LabelSettings_55nrw")
|
||||
label_settings = SubResource("LabelSettings_esyuk")
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cxcvc1rjvm8i2"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/ItemDropped.gd" id="1_v2djl"]
|
||||
[ext_resource type="Texture2D" uid="uid://bks8jmctleina" path="res://resources/items/baseball.svg" id="2_4hl42"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7lt1c"]
|
||||
radius = 7.0
|
||||
|
||||
[node name="ItemDropped" type="RigidBody2D"]
|
||||
script = ExtResource("1_v2djl")
|
||||
|
||||
[node name="texture" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(0.25, 0.25)
|
||||
texture = ExtResource("2_4hl42")
|
||||
|
||||
[node name="hitbox" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_7lt1c")
|
||||
@@ -21,6 +21,7 @@ project/assembly_name="ChickenVSBear"
|
||||
|
||||
[gui]
|
||||
|
||||
theme/custom="res://themes/main.tres"
|
||||
theme/custom_font="res://resources/fonts/HarmonyOS_Sans_Regular.ttf"
|
||||
|
||||
[input]
|
||||
@@ -56,6 +57,11 @@ sprint={
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
2d/default_gravity=0.0
|
||||
2d/default_linear_damp=1.0
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
|
||||
@@ -20,6 +20,8 @@ var fields = {
|
||||
ItemStore.ItemType.BASEBALL: 0,
|
||||
ItemStore.ItemType.BASKETBALL: 0
|
||||
}
|
||||
@export var drops: Array[ItemStore.ItemType] = []
|
||||
@export var dropCounts: Array[Vector2] = []
|
||||
|
||||
@onready var animatree: AnimationTree = $"%animatree"
|
||||
@onready var texture: AnimatedSprite2D = $"%texture"
|
||||
@@ -38,7 +40,15 @@ var sprinting: bool = false
|
||||
func _ready():
|
||||
health = fields.get(FieldStore.Entity.MAX_HEALTH)
|
||||
statebar.visible = !isBoss
|
||||
if !isPlayer():
|
||||
if isPlayer():
|
||||
UIState.player = self
|
||||
hurtbox.body_entered.connect(
|
||||
func(body):
|
||||
if body is ItemDropped:
|
||||
inventory[body.item] += body.stackCount
|
||||
body.queue_free()
|
||||
)
|
||||
else:
|
||||
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
|
||||
func _process(_delta):
|
||||
health = clamp(health, 0, fields.get(FieldStore.Entity.MAX_HEALTH))
|
||||
@@ -78,7 +88,7 @@ func takeDamage(bullet: BulletBase, crit: bool):
|
||||
if health <= 0:
|
||||
if isBoss:
|
||||
bullet.launcher.setBoss(null)
|
||||
die()
|
||||
tryDie()
|
||||
func isCooldowned():
|
||||
return Time.get_ticks_msec() - lastAttack >= cooldownUnit / fields.get(FieldStore.Entity.ATTACK_SPEED)
|
||||
func startCooldown():
|
||||
@@ -96,6 +106,13 @@ func trySprint():
|
||||
playSound("sprint")
|
||||
sprint()
|
||||
sprinting = true
|
||||
func tryDie():
|
||||
for drop in range(min(len(drops), len(dropCounts))):
|
||||
var item = drops[drop]
|
||||
var count = ceil(randf_range(dropCounts[drop].x, dropCounts[drop].y))
|
||||
for i in range(count):
|
||||
ItemDropped.generate(item, count, position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset))
|
||||
die()
|
||||
func findWeaponAnchor(weaponName: String):
|
||||
var anchor = $"%weapons".get_node(weaponName)
|
||||
if anchor is Node2D:
|
||||
|
||||
@@ -8,7 +8,7 @@ class_name FieldShow
|
||||
@onready var nameLabel: Label = $"%name"
|
||||
@onready var valueLabel: Label = $"%value"
|
||||
|
||||
func _ready():
|
||||
func _physics_process(_delta):
|
||||
nameLabel.text = FieldStore.entityMap[field]
|
||||
var formattedValue: String
|
||||
var dataType = FieldStore.entityMapType[field]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
extends Control
|
||||
@@ -0,0 +1,39 @@
|
||||
extends RigidBody2D
|
||||
class_name ItemDropped
|
||||
|
||||
var item: ItemStore.ItemType = ItemStore.ItemType.BASEBALL
|
||||
var stackCount: int = 1
|
||||
var targetPlayer: EntityBase = null
|
||||
|
||||
@onready var texture: Sprite2D = $"%texture"
|
||||
|
||||
func _process(_delta):
|
||||
texture.texture = ItemStore.getTexture(item)
|
||||
func _physics_process(_delta):
|
||||
if !is_instance_valid(targetPlayer):
|
||||
targetPlayer = findPlayer()
|
||||
if is_instance_valid(targetPlayer):
|
||||
apply_central_force((targetPlayer.position - position).normalized() * 1000)
|
||||
func findPlayer() -> EntityBase:
|
||||
var result = null
|
||||
var lastDistance = INF
|
||||
for player in get_tree().get_nodes_in_group("players"):
|
||||
if player is EntityBase:
|
||||
if position.distance_to(player.position) < lastDistance:
|
||||
lastDistance = position.distance_to(player.position)
|
||||
result = player
|
||||
return result
|
||||
|
||||
static func generate(
|
||||
itemType: ItemStore.ItemType,
|
||||
count: int,
|
||||
spawnPosition: Vector2,
|
||||
addToWorld: bool = true
|
||||
):
|
||||
var instance: ItemDropped = preload("res://components/UI/ItemDropped.tscn").instantiate()
|
||||
instance.item = itemType
|
||||
instance.stackCount = count
|
||||
instance.position = spawnPosition
|
||||
if addToWorld:
|
||||
WorldManager.rootNode.call_deferred("add_child", instance)
|
||||
return instance
|
||||
@@ -8,6 +8,6 @@ class_name ItemShow
|
||||
@onready var avatarTexture: TextureRect = $"%avatar"
|
||||
@onready var countLabel: Label = $"%count"
|
||||
|
||||
func _ready():
|
||||
avatarTexture.texture = load("res://resources/items/%s.svg" % ItemStore.idMap[type])
|
||||
func _physics_process(_delta: float):
|
||||
avatarTexture.texture = ItemStore.getTexture(type)
|
||||
countLabel.text = str(count)
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
extends CanvasLayer
|
||||
class_name UIState
|
||||
|
||||
@onready var baseball = $"%baseball"
|
||||
@onready var basketball = $"%basketball"
|
||||
|
||||
static var player: EntityBase = null
|
||||
static var bossbar: EntityStateBar
|
||||
|
||||
func _ready():
|
||||
bossbar = $"%bossbar"
|
||||
func _process(_delta):
|
||||
bossbar.visible = !!bossbar.entity
|
||||
func _physics_process(_delta):
|
||||
if is_instance_valid(player):
|
||||
baseball.count = player.inventory[ItemStore.ItemType.BASEBALL]
|
||||
basketball.count = player.inventory[ItemStore.ItemType.BASKETBALL]
|
||||
|
||||
@@ -13,7 +13,14 @@ class_name Feed
|
||||
@onready var nameLabel: RichTextLabel = $"%name"
|
||||
@onready var fieldsBox: VBoxContainer = $"%fields"
|
||||
@onready var costsBox: GridContainer = $"%costs"
|
||||
@onready var selectButton: Button = $"%selectBtn"
|
||||
|
||||
func _ready():
|
||||
selectButton.pressed.connect(
|
||||
func():
|
||||
apply(UIState.player)
|
||||
queue_free()
|
||||
)
|
||||
func _process(_delta):
|
||||
avatarRect.texture = avatarTexture
|
||||
nameLabel.text = "[b]" + displayName + "[/b]"
|
||||
@@ -39,6 +46,7 @@ func _process(_delta):
|
||||
costShow.type = cost
|
||||
costShow.count = count
|
||||
costsBox.add_child(costShow)
|
||||
|
||||
func apply(entity: EntityBase):
|
||||
var allHave = true
|
||||
for i in range(min(costs.size(), costCounts.size())):
|
||||
|
||||
@@ -4,3 +4,4 @@ static var allowFriendlyFire: bool = false # 是否允许友军伤害
|
||||
static var bulletSpeedMultiplier: float = 1 # 子弹速度倍率
|
||||
static var damageOffset: float = 0.2 # 伤害随机浮动比例,默认20%,即10的基础伤害会应用为8~12
|
||||
static var damageLabelSpawnOffset: float = 10 # 伤害标签生成位置的随机偏移
|
||||
static var itemDroppedSpawnOffset: float = 10 # 掉落物生成位置的随机偏移
|
||||
|
||||
@@ -13,3 +13,5 @@ static var idMap = {
|
||||
ItemType.BASEBALL: "baseball",
|
||||
ItemType.BASKETBALL: "basketball"
|
||||
}
|
||||
static func getTexture(type: ItemType) -> Texture2D:
|
||||
return load("res://resources/items/%s.svg" % idMap[type])
|
||||
@@ -0,0 +1,88 @@
|
||||
[gd_resource type="Theme" load_steps=7 format=3 uid="uid://dhvs6urgf6jr5"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2jby4"]
|
||||
content_margin_left = 5.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 5.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
border_color = Color(0, 0, 0, 0.5)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bpyjs"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4j7ii"]
|
||||
content_margin_left = 5.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 5.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0, 0, 0, 0.3)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(1, 1, 1, 0.5)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mt3v0"]
|
||||
content_margin_left = 5.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 5.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(1, 1, 1, 0.3)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3nqwh"]
|
||||
content_margin_left = 5.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 5.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(1, 1, 1, 0.3)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_iekfp"]
|
||||
content_margin_left = 5.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 5.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(1, 1, 1, 0.3)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[resource]
|
||||
Button/font_sizes/font_size = 14
|
||||
Button/styles/disabled = SubResource("StyleBoxFlat_2jby4")
|
||||
Button/styles/focus = SubResource("StyleBoxEmpty_bpyjs")
|
||||
Button/styles/hover = SubResource("StyleBoxFlat_4j7ii")
|
||||
Button/styles/hover_pressed = SubResource("StyleBoxFlat_mt3v0")
|
||||
Button/styles/normal = SubResource("StyleBoxFlat_3nqwh")
|
||||
Button/styles/pressed = SubResource("StyleBoxFlat_iekfp")
|
||||
@@ -0,0 +1,4 @@
|
||||
[gd_resource type="Theme" format=3 uid="uid://cq3ciq3ly7oxb"]
|
||||
|
||||
[resource]
|
||||
Label/font_sizes/font_size = 11
|
||||
Reference in New Issue
Block a user