1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-07 04:07:13 +08:00

feat(武器系统): 重构武器攻击逻辑并添加音效支持

- 将武器攻击逻辑移至Weapon类中,添加tryAttack方法统一处理冷却和能量消耗
- 为武器添加音效支持,包括攻击音效的播放和管理
- 移除子弹生成时的能量消耗检查,改由武器统一处理
- 调整部分武器的属性和配置,如伤害值和冷却时间
- 修复紫水晶子弹的分裂和折射逻辑错误
This commit is contained in:
2025-09-06 08:50:37 +08:00
parent c593a809dc
commit 9ea534441b
10 changed files with 51 additions and 25 deletions
+5
View File
@@ -29,6 +29,11 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr")
script = ExtResource("1_g802t")
metadata/_edit_lock_ = true
[node name="sounds" type="Node2D" parent="."]
unique_name_in_owner = true
[node name="attack" type="AudioStreamPlayer2D" parent="sounds"]
[node name="container" type="VBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 10
-1
View File
@@ -47,7 +47,6 @@ process_mode = 4
[node name="PurpleCrystal" parent="weaponStore" index="0" instance=ExtResource("3_ms5sq")]
[node name="LGBT" parent="weaponStore" index="1" instance=ExtResource("4_pb8qn")]
debugRebuild = false
[node name="sprint" parent="sounds" index="0"]
stream = ExtResource("4_66s6c")
+6 -1
View File
@@ -1,8 +1,9 @@
[gd_scene load_steps=4 format=3 uid="uid://cxabqjo7skxev"]
[gd_scene load_steps=5 format=3 uid="uid://cxabqjo7skxev"]
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_wrvv5"]
[ext_resource type="Script" path="res://scripts/Contents/Weapons/BigLaser.gd" id="2_gmch0"]
[ext_resource type="Texture2D" uid="uid://dy4op6n6vxef3" path="res://resources/bullets/laser-circle/circle.svg" id="2_qe8gb"]
[ext_resource type="AudioStream" uid="uid://b10u6iir6uvqn" path="res://resources/sounds/effect/BigLaser.wav" id="4_cb5nh"]
[node name="BigLaser" instance=ExtResource("1_wrvv5")]
script = ExtResource("2_gmch0")
@@ -16,10 +17,14 @@ store = {
"atk": 35,
"time": 0.1
}
storeType = Array[int]([0, 0])
descriptionTemplate = "每$time秒造成$atk点伤害。"
needEnergy = 100.0
cooldown = 6000.0
[node name="attack" parent="sounds" index="0"]
stream = ExtResource("4_cb5nh")
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_qe8gb")
+1
View File
@@ -22,6 +22,7 @@ store = {
storeType = Array[int]([2, 0, 0, 1, 0])
descriptionTemplate = "发射$count条,每条间分隔$angle,可追踪$trace秒,效率为$power的带状彩虹,每条造成$atk点伤害。"
needEnergy = 150.0
cooldown = 2000.0
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_ou6jo")
+7 -4
View File
@@ -1,12 +1,12 @@
[gd_scene load_steps=4 format=3 uid="uid://c0n3igy4hucrg"]
[gd_scene load_steps=5 format=3 uid="uid://c0n3igy4hucrg"]
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_hyubh"]
[ext_resource type="Script" path="res://scripts/Contents/Weapons/PurpleCrystal.gd" id="2_0xgcv"]
[ext_resource type="Texture2D" uid="uid://16yhngg3jpun" path="res://resources/weapons/purple-crystal.svg" id="2_wgtcw"]
[ext_resource type="AudioStream" uid="uid://dclinyhu256xi" path="res://resources/sounds/effect/Low Whoosh.mp3" id="4_16daa"]
[node name="PurpleCrystal" instance=ExtResource("1_hyubh")]
offset_right = 208.0
offset_bottom = 282.0
offset_bottom = 302.0
script = ExtResource("2_0xgcv")
avatarTexture = ExtResource("2_wgtcw")
displayName = "紫水晶簇"
@@ -15,6 +15,9 @@ costCounts = Array[int]([50, 10])
descriptionTemplate = "撞击造成$atk点伤害。"
cooldown = 200.0
[node name="attack" parent="sounds" index="0"]
stream = ExtResource("4_16daa")
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_wgtcw")
@@ -22,4 +25,4 @@ texture = ExtResource("2_wgtcw")
displayName = "紫水晶簇"
[node name="description" parent="container" index="2"]
text = "撞击造成[color=cyan]10.0[/color]点伤害。"
text = "[center]撞击造成[color=cyan]10.0[/color]点伤害。[/center]"