From de7dd468fe38daa46a3c7e859eb5241fb2b9c9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Tue, 23 Sep 2025 22:29:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ChainGun):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=AD=A6=E5=99=A8=E5=B1=9E=E6=80=A7=E5=92=8C=E5=AD=90=E5=BC=B9?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改ChainGun的数值属性和子弹生成方式,新增split参数控制子弹间距 调整BossBar的样式和位置,删除未使用的shader文件 --- components/Characters/Rooster.tscn | 2 +- components/UI/BossBar.tscn | 53 +++++++++++++++++++++++----- components/Weapons/ChainGun.tscn | 15 ++++---- scripts/Contents/Bullets/ChainGun.gd | 3 +- scripts/Contents/Weapons/ChainGun.gd | 4 ++- shaders/FilledRing.gdshader | 13 ------- shaders/Light.gdshader | 9 ----- 7 files changed, 60 insertions(+), 39 deletions(-) diff --git a/components/Characters/Rooster.tscn b/components/Characters/Rooster.tscn index 26d4680..639b752 100644 --- a/components/Characters/Rooster.tscn +++ b/components/Characters/Rooster.tscn @@ -47,7 +47,7 @@ displayName = "公鸡" process_mode = 4 [node name="ChainGun" parent="weaponStore" index="0" instance=ExtResource("3_inwol")] -offset_bottom = 330.0 +offset_bottom = 352.0 [node name="PurpleCrystal" parent="weaponStore" index="1" instance=ExtResource("3_ms5sq")] debugRebuild = false diff --git a/components/UI/BossBar.tscn b/components/UI/BossBar.tscn index 2bda243..c362270 100644 --- a/components/UI/BossBar.tscn +++ b/components/UI/BossBar.tscn @@ -1,14 +1,47 @@ -[gd_scene load_steps=5 format=3 uid="uid://ofpg5s3j7esv"] +[gd_scene load_steps=9 format=3 uid="uid://ofpg5s3j7esv"] [ext_resource type="Script" path="res://scripts/Statemachine/BossBar.gd" id="1_hkj6o"] [ext_resource type="PackedScene" uid="uid://d1ulrvupa76ap" path="res://components/UI/ColorBar.tscn" id="1_uxey7"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0aktd"] +bg_color = Color(0, 0, 0, 0.5) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 +corner_detail = 1 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gor8g"] +bg_color = Color(1, 0, 0, 0.5) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 +corner_detail = 1 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g3ag3"] +bg_color = Color(0, 1, 0, 0.5) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 +corner_detail = 1 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bua1u"] +bg_color = Color(1, 1, 1, 1) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 +corner_detail = 1 + [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ar00p"] content_margin_left = 10.0 [sub_resource type="LabelSettings" id="LabelSettings_esyuk"] font_size = 12 font_color = Color(0, 0, 0, 1) +outline_size = 2 [node name="BossBar" type="Control"] layout_mode = 3 @@ -23,16 +56,20 @@ script = ExtResource("1_hkj6o") unique_name_in_owner = true layout_mode = 1 anchors_preset = -1 -anchor_left = 0.2 -anchor_top = 1.0 -anchor_right = 0.8 -anchor_bottom = 1.0 -offset_top = -65.0 +anchor_left = 0.3 +anchor_top = 0.95 +anchor_right = 0.7 +anchor_bottom = 0.95 +offset_top = -30.0 offset_right = 0.0 -offset_bottom = -40.0 +offset_bottom = 0.0 grow_horizontal = 2 -grow_vertical = 0 +grow_vertical = 2 currentValue = 0.0 +backBox = SubResource("StyleBoxFlat_0aktd") +middleBox1 = SubResource("StyleBoxFlat_gor8g") +middleBox2 = SubResource("StyleBoxFlat_g3ag3") +frontBox = SubResource("StyleBoxFlat_bua1u") [node name="panel" type="PanelContainer" parent="health"] layout_mode = 1 diff --git a/components/Weapons/ChainGun.tscn b/components/Weapons/ChainGun.tscn index cf994f1..ccb83b4 100644 --- a/components/Weapons/ChainGun.tscn +++ b/components/Weapons/ChainGun.tscn @@ -10,16 +10,19 @@ avatarTexture = ExtResource("2_ghn43") displayName = "链式机枪" costBeachball = 400 store = { -"atk": 5, -"count": 1 +"atk": 7, +"count": 1, +"split": 20 } storeType = { "atk": 1, -"count": 1 +"count": 1, +"split": 1 } -descriptionTemplate = "发射$count个[b]微型水晶[/b],可造成$atk点伤害。" +descriptionTemplate = "以$split单位的间隔发射$count个[b]微型水晶[/b],可造成$atk点伤害。" needEnergy = 1.0 -cooldown = 66.0 +cooldown = 50.0 +debugRebuild = true [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_ghn43") @@ -34,4 +37,4 @@ text = "400" displayName = "链式机枪" [node name="description" parent="container" index="2"] -text = "[center]发射[color=cyan]2[/color]→[color=yellow]2[/color]个[b]微型水晶[/b],可造成[color=cyan]5[/color]→[color=yellow]7[/color]点伤害。[/center]" +text = "[center]以[color=cyan]20[/color]→[color=yellow]0[/color]单位的间隔发射[color=cyan]1[/color]→[color=yellow]1[/color]个[b]微型水晶[/b],可造成[color=cyan]7[/color]→[color=yellow]9[/color]点伤害。[/center]" diff --git a/scripts/Contents/Bullets/ChainGun.gd b/scripts/Contents/Bullets/ChainGun.gd index a30c2db..445a144 100644 --- a/scripts/Contents/Bullets/ChainGun.gd +++ b/scripts/Contents/Bullets/ChainGun.gd @@ -1,6 +1,7 @@ extends BulletBase var count: int = 1 +var splits: float = 10.0 @onready var anchor: Node2D = $"%anchor" @@ -9,6 +10,6 @@ func spawn(): for i in BulletBase.generate(ComponentManager.getBullet("PurpleCrystalSmall"), launcher, anchor.global_position, rotation): i.damage = damage var dir = Vector2.from_angle(i.rotation).rotated(deg_to_rad(-90)) - i.global_position += dir * (count - j * 2) * 20 / 2 + i.global_position += dir * (count - j * 2) * splits / 2 func ai(): PresetBulletAI.lockLauncher(self, launcher, true) diff --git a/scripts/Contents/Weapons/ChainGun.gd b/scripts/Contents/Weapons/ChainGun.gd index 7fdb5b2..7b1c609 100644 --- a/scripts/Contents/Weapons/ChainGun.gd +++ b/scripts/Contents/Weapons/ChainGun.gd @@ -3,9 +3,11 @@ extends Weapon func update(to, origin, _entity): origin["atk"] += 2 * to * soulLevel - origin["count"] += 0.25 * to * soulLevel + origin["count"] = 1 * soulLevel + origin["split"] /= 1 + 0.05 * to * soulLevel return origin func attack(entity: EntityBase): for i in BulletBase.generate(ComponentManager.getBullet("ChainGun"), entity, entity.texture.global_position, (get_global_mouse_position() - entity.texture.global_position).angle()): i.damage = readStore("atk") i.count = floor(readStore("count")) + i.split = readStore("split") diff --git a/shaders/FilledRing.gdshader b/shaders/FilledRing.gdshader index 1ba83df..e69de29 100644 --- a/shaders/FilledRing.gdshader +++ b/shaders/FilledRing.gdshader @@ -1,13 +0,0 @@ -shader_type canvas_item; -uniform float inner:hint_range(0.0, 1.0, 0.01)=0.5; -uniform float outer:hint_range(0.0, 1.0, 0.01)=0.75; -uniform float alpha:hint_range(0.0, 1.0, 0.1)=0.5; -void fragment() { - vec2 center=vec2(0.5); - float dist=distance(UV,center)*2.0; - if(dist