diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx index 6fad837..8c505f0 100644 --- a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index 9c3046b..11ed22b 100644 --- a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx index cbea38c..b7e8df3 100644 --- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx Binary files differ diff --git a/DungeonShooting_Godot/prefab/role/Role0001.tscn b/DungeonShooting_Godot/prefab/role/Role0001.tscn index 497896e..4717b1d 100644 --- a/DungeonShooting_Godot/prefab/role/Role0001.tscn +++ b/DungeonShooting_Godot/prefab/role/Role0001.tscn @@ -10,12 +10,14 @@ shader = ExtResource("3_rk4gg") shader_parameter/blend = Color(0, 0, 0, 0.470588) shader_parameter/schedule = 1.0 +shader_parameter/alpha = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_5ok5s"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_8hgu2"] resource_local_to_scene = true shader = ExtResource("3_rk4gg") shader_parameter/blend = Color(1, 1, 1, 1) shader_parameter/schedule = 0.0 +shader_parameter/alpha = 1.0 [node name="Role0001" node_paths=PackedStringArray("HurtArea", "MountPoint", "BackMountPoint", "InteractiveArea", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_10c2n")] collision_layer = 8 @@ -32,6 +34,6 @@ material = SubResource("ShaderMaterial_lvutq") [node name="AnimatedSprite" parent="." index="2"] -material = SubResource("ShaderMaterial_5ok5s") +material = SubResource("ShaderMaterial_8hgu2") sprite_frames = ExtResource("4_galcc") frame_progress = 0.0995217 diff --git a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn index 8554aa3..f7fe65a 100644 --- a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn +++ b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn @@ -1,15 +1,11 @@ -[gd_scene load_steps=14 format=3 uid="uid://bvpmtfupny8iu"] +[gd_scene load_steps=10 format=3 uid="uid://bvpmtfupny8iu"] [ext_resource type="Script" path="res://src/game/ui/roomUI/RoomUIPanel.cs" id="1_tfcrp"] [ext_resource type="Texture2D" uid="uid://b67i86mtqrn32" path="res://resource/sprite/ui/icon/icon_bullet.png" id="2_a2ohq"] [ext_resource type="Texture2D" uid="uid://dxstii6f4l8m0" path="res://resource/sprite/ui/keyboard/e.png" id="3_h7n2a"] [ext_resource type="Texture2D" uid="uid://cukrx5yyqw86o" path="res://resource/sprite/ui/reloadBar.png" id="4_nt6mj"] [ext_resource type="Texture2D" uid="uid://cx3i1nkcc4307" path="res://resource/sprite/ui/reloadBarBlock.png" id="5_wob8d"] -[ext_resource type="Texture2D" uid="uid://u5ul7fu8wv1a" path="res://resource/sprite/ui/healthBar.png" id="6_e4f48"] -[ext_resource type="Texture2D" uid="uid://djcdjrs07ighv" path="res://resource/sprite/ui/hpSlot.png" id="7_kk5l8"] -[ext_resource type="Texture2D" uid="uid://bxd75tme0v3pb" path="res://resource/sprite/ui/hpBar.png" id="8_j85pm"] -[ext_resource type="Texture2D" uid="uid://dnpguajopuyd7" path="res://resource/sprite/ui/shieldSlot.png" id="9_spw0e"] -[ext_resource type="Texture2D" uid="uid://h25j6uka74tv" path="res://resource/sprite/ui/shieldBar.png" id="10_8lm6q"] +[ext_resource type="Texture2D" uid="uid://blywnftxn1cfd" path="res://resource/sprite/ui/Life_full.png" id="11_y2dqd"] [ext_resource type="Texture2D" uid="uid://k621mhhkg65f" path="res://resource/sprite/ui/mapBar.png" id="11_yaqsk"] [ext_resource type="Texture2D" uid="uid://xafbhgrxmosy" path="res://resource/sprite/weapon/gun4.png" id="12_o2big"] @@ -67,54 +63,17 @@ offset_bottom = -20.0 mouse_filter = 2 -[node name="HealthBar" type="TextureRect" parent="Control"] -layout_mode = 0 -offset_right = 14.0 -offset_bottom = 14.0 +[node name="LifeBar" type="Control" parent="Control"] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 scale = Vector2(4, 4) -texture = ExtResource("6_e4f48") -[node name="HpSlot" type="NinePatchRect" parent="Control/HealthBar"] -layout_mode = 0 -offset_left = 13.0 -offset_top = 1.0 -offset_right = 66.0 -offset_bottom = 9.0 -texture = ExtResource("7_kk5l8") -patch_margin_left = 1 -patch_margin_top = 1 -patch_margin_right = 2 -patch_margin_bottom = 1 - -[node name="HpBar" type="TextureRect" parent="Control/HealthBar/HpSlot"] -layout_mode = 0 -offset_left = 1.0 -offset_top = 2.0 -offset_right = 51.0 -offset_bottom = 6.0 -texture = ExtResource("8_j85pm") -expand_mode = 1 - -[node name="ShieldSlot" type="NinePatchRect" parent="Control/HealthBar"] -layout_mode = 0 -offset_left = 13.0 -offset_top = 8.0 -offset_right = 65.0 -offset_bottom = 13.0 -texture = ExtResource("9_spw0e") -patch_margin_left = 1 -patch_margin_top = 1 -patch_margin_right = 1 -patch_margin_bottom = 1 - -[node name="ShieldBar" type="TextureRect" parent="Control/HealthBar/ShieldSlot"] -layout_mode = 0 -offset_left = 1.0 -offset_top = 1.0 -offset_right = 51.0 -offset_bottom = 4.0 -texture = ExtResource("10_8lm6q") -expand_mode = 1 +[node name="Life" type="TextureRect" parent="Control/LifeBar"] +layout_mode = 2 +offset_right = 12.0 +offset_bottom = 10.0 +texture = ExtResource("11_y2dqd") [node name="MapBar" type="TextureRect" parent="Control"] layout_mode = 1 diff --git a/DungeonShooting_Godot/resource/config/Weapon.json b/DungeonShooting_Godot/resource/config/Weapon.json index afa027f..1c00f54 100644 --- a/DungeonShooting_Godot/resource/config/Weapon.json +++ b/DungeonShooting_Godot/resource/config/Weapon.json @@ -319,8 +319,8 @@ "MaxFireBulletCount": 1, "DelayedTime": 0, "StartScatteringRange": 5, - "FinalScatteringRange": 60, - "ScatteringRangeAddValue": 8, + "FinalScatteringRange": 35, + "ScatteringRangeAddValue": 4, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, "MinBacklash": 3, @@ -391,8 +391,8 @@ "MaxFireBulletCount": 1, "DelayedTime": 0, "StartScatteringRange": 5, - "FinalScatteringRange": 60, - "ScatteringRangeAddValue": 8, + "FinalScatteringRange": 35, + "ScatteringRangeAddValue": 4, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, "MinBacklash": 3, diff --git a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn index 7c48b25..b971027 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn +++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn @@ -16,37 +16,9 @@ Type = 1 Altitude = 0 -[node name="ActivityMark4" type="Node2D" parent="."] -position = Vector2(129, 68) -script = ExtResource("3_m4jrh") -Type = 5 -ItemExpression = "0002" -WaveNumber = 2 - -[node name="ActivityMark5" type="Node2D" parent="."] -position = Vector2(128, 20) -script = ExtResource("3_m4jrh") -Type = 5 -ItemExpression = "0005" -WaveNumber = 2 - -[node name="ActivityMark6" type="Node2D" parent="."] -position = Vector2(31, 18) -script = ExtResource("3_m4jrh") -Type = 5 -ItemExpression = "0001" -WaveNumber = 2 - [node name="ActivityMark7" type="Node2D" parent="."] -position = Vector2(31, 72) +position = Vector2(79, 76) script = ExtResource("3_m4jrh") Type = 5 ItemExpression = "0003" WaveNumber = 2 - -[node name="ActivityMark8" type="Node2D" parent="."] -position = Vector2(61, 62) -script = ExtResource("3_m4jrh") -Type = 5 -ItemExpression = "0006" -WaveNumber = 2 diff --git a/DungeonShooting_Godot/resource/material/Blend.gdshader b/DungeonShooting_Godot/resource/material/Blend.gdshader index fcc9b33..a161bcb 100644 --- a/DungeonShooting_Godot/resource/material/Blend.gdshader +++ b/DungeonShooting_Godot/resource/material/Blend.gdshader @@ -2,9 +2,12 @@ uniform vec4 blend : source_color = vec4(1.0, 1.0, 1.0, 1.0); uniform float schedule = 0.0; +uniform float alpha = 1.0; void fragment() { vec4 textureColor = texture(TEXTURE, UV); vec4 col = mix(textureColor, blend, schedule); - COLOR = mix(vec4(0.0, 0.0, 0.0, 0.0), col, textureColor.a); + col = mix(vec4(0.0, 0.0, 0.0, 0.0), col, textureColor.a); + col.a *= alpha; + COLOR = col; } diff --git a/DungeonShooting_Godot/resource/material/Blend.tres b/DungeonShooting_Godot/resource/material/Blend.tres index 02c6b22..bfdddeb 100644 --- a/DungeonShooting_Godot/resource/material/Blend.tres +++ b/DungeonShooting_Godot/resource/material/Blend.tres @@ -1,11 +1,10 @@ -[gd_resource type="ShaderMaterial" load_steps=2 format=3] +[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://cces3bhds7jyi"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="1"] - [resource] resource_local_to_scene = true -render_priority = 4 -shader = ExtResource( 1 ) -shader_param/blend = Color( 0, 0, 0, 0.470588 ) -shader_param/schedule = 1 +shader = ExtResource("1") +shader_parameter/blend = Color(0, 0, 0, 0.470588) +shader_parameter/schedule = 0.0 +shader_parameter/alpha = 0.0 diff --git a/DungeonShooting_Godot/resource/sprite/ui/Life_empty.png b/DungeonShooting_Godot/resource/sprite/ui/Life_empty.png new file mode 100644 index 0000000..855185f --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Life_empty.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/Life_empty.png.import b/DungeonShooting_Godot/resource/sprite/ui/Life_empty.png.import new file mode 100644 index 0000000..fbd6452 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Life_empty.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dv3qskyc0dcmy" +path="res://.godot/imported/Life_empty.png-0adf786e78d4b12d461b0eb1e1990e81.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/Life_empty.png" +dest_files=["res://.godot/imported/Life_empty.png-0adf786e78d4b12d461b0eb1e1990e81.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/Life_full.png b/DungeonShooting_Godot/resource/sprite/ui/Life_full.png new file mode 100644 index 0000000..983b566 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Life_full.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/Life_full.png.import b/DungeonShooting_Godot/resource/sprite/ui/Life_full.png.import new file mode 100644 index 0000000..faffa5c --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Life_full.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://blywnftxn1cfd" +path="res://.godot/imported/Life_full.png-fb9a520bfad66b139d42ac2f023ffc04.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/Life_full.png" +dest_files=["res://.godot/imported/Life_full.png-fb9a520bfad66b139d42ac2f023ffc04.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/Life_half.png b/DungeonShooting_Godot/resource/sprite/ui/Life_half.png new file mode 100644 index 0000000..581f4a2 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Life_half.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/Life_half.png.import b/DungeonShooting_Godot/resource/sprite/ui/Life_half.png.import new file mode 100644 index 0000000..e672f04 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Life_half.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cnnl07abi51ph" +path="res://.godot/imported/Life_half.png-db960c6dc9d158324f8b8c8db8be7d36.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/Life_half.png" +dest_files=["res://.godot/imported/Life_half.png-db960c6dc9d158324f8b8c8db8be7d36.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/Shield_empty.png b/DungeonShooting_Godot/resource/sprite/ui/Shield_empty.png new file mode 100644 index 0000000..f9c435e --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Shield_empty.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/Shield_empty.png.import b/DungeonShooting_Godot/resource/sprite/ui/Shield_empty.png.import new file mode 100644 index 0000000..f8a3413 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Shield_empty.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jtg0wkxir2w4" +path="res://.godot/imported/Shield_empty.png-9ad07f3ce895c2829d28d6052a42461b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/Shield_empty.png" +dest_files=["res://.godot/imported/Shield_empty.png-9ad07f3ce895c2829d28d6052a42461b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/Shield_full.png b/DungeonShooting_Godot/resource/sprite/ui/Shield_full.png new file mode 100644 index 0000000..ed0095b --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Shield_full.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/Shield_full.png.import b/DungeonShooting_Godot/resource/sprite/ui/Shield_full.png.import new file mode 100644 index 0000000..8c57956 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/Shield_full.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bhr8n3ytchbqi" +path="res://.godot/imported/Shield_full.png-5036f32a904683d2e732c6d6d0e7c23d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/Shield_full.png" +dest_files=["res://.godot/imported/Shield_full.png-5036f32a904683d2e732c6d6d0e7c23d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index 46b8c1e..ec222d8 100644 --- a/DungeonShooting_Godot/resource/theme/mainTheme.tres +++ b/DungeonShooting_Godot/resource/theme/mainTheme.tres @@ -352,7 +352,7 @@ [sub_resource type="ImageTexture" id="58"] -[sub_resource type="Image" id="Image_7cp2c"] +[sub_resource type="Image" id="Image_wvsbp"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -362,7 +362,7 @@ } [sub_resource type="ImageTexture" id="60"] -image = SubResource("Image_7cp2c") +image = SubResource("Image_wvsbp") [sub_resource type="StyleBoxTexture" id="61"] content_margin_left = 2.0 @@ -372,7 +372,7 @@ texture = SubResource("60") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_nb7g2"] +[sub_resource type="Image" id="Image_fcbqq"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -382,7 +382,7 @@ } [sub_resource type="ImageTexture" id="63"] -image = SubResource("Image_nb7g2") +image = SubResource("Image_fcbqq") [sub_resource type="StyleBoxTexture" id="64"] content_margin_left = 2.0 @@ -392,7 +392,7 @@ texture = SubResource("63") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_bsp3h"] +[sub_resource type="Image" id="Image_w7mfv"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -402,7 +402,7 @@ } [sub_resource type="ImageTexture" id="66"] -image = SubResource("Image_bsp3h") +image = SubResource("Image_w7mfv") [sub_resource type="StyleBoxTexture" id="67"] content_margin_left = 2.0 @@ -412,7 +412,7 @@ texture = SubResource("66") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_l2654"] +[sub_resource type="Image" id="Image_5e8pa"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -422,7 +422,7 @@ } [sub_resource type="ImageTexture" id="69"] -image = SubResource("Image_l2654") +image = SubResource("Image_5e8pa") [sub_resource type="StyleBoxTexture" id="70"] content_margin_left = 0.0 @@ -446,7 +446,7 @@ content_margin_right = 4.0 content_margin_bottom = 4.0 -[sub_resource type="Image" id="Image_61eau"] +[sub_resource type="Image" id="Image_af734"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 228, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 228, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 18, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 17, 255, 255, 255, 186, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 191, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 186, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 189, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 77, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 77, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -456,7 +456,7 @@ } [sub_resource type="ImageTexture" id="56"] -image = SubResource("Image_61eau") +image = SubResource("Image_af734") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 diff --git a/DungeonShooting_Godot/src/framework/IClone.cs b/DungeonShooting_Godot/src/framework/IClone.cs new file mode 100644 index 0000000..f14feb6 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/IClone.cs @@ -0,0 +1,8 @@ + +public interface IClone +{ + /// + /// 克隆当前对象 + /// + T Clone(); +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index 7a7d794..920f5b4 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -208,8 +208,6 @@ //组件集合 private List> _components = new List>(); - //是否初始化阴影 - private bool _initShadow; //上一帧动画名称 private string _prevAnimation; //上一帧动画 @@ -221,6 +219,7 @@ //混色shader材质 private ShaderMaterial _blendShaderMaterial; + private ShaderMaterial _shadowBlendShaderMaterial; //存储投抛该物体时所产生的数据 private ActivityFallData _fallData = new ActivityFallData(); @@ -280,6 +279,7 @@ ItemId = itemId; Name = GetType().Name + (_instanceIndex++); _blendShaderMaterial = AnimatedSprite.Material as ShaderMaterial; + _shadowBlendShaderMaterial = ShadowSprite.Material as ShaderMaterial; ShadowSprite.Visible = false; MotionMode = MotionModeEnum.Floating; MoveController = AddComponent(); @@ -331,12 +331,6 @@ /// public void ShowShadowSprite() { - if (!_initShadow) - { - _initShadow = true; - ShadowSprite.Material = ResourceManager.BlendMaterial; - } - var anim = AnimatedSprite.Animation; var frame = AnimatedSprite.Frame; @@ -751,7 +745,23 @@ { return _blendShaderMaterial.GetShaderParameter("schedule").AsSingle(); } + + /// + /// 设置透明度 + /// + public void SetBlendAlpha(float value) + { + _blendShaderMaterial.SetShaderParameter("alpha", value); + _shadowBlendShaderMaterial.SetShaderParameter("alpha", value); + } + /// + /// 获取透明度 + /// + public float SetBlendAlpha() + { + return _blendShaderMaterial.GetShaderParameter("alpha").AsSingle(); + } /// /// 每帧调用一次, 为了防止子类覆盖 _Process(), 给 _Process() 加上了 sealed, 子类需要帧循环函数请重写 Process() 函数 diff --git a/DungeonShooting_Godot/src/framework/coroutine/CoroutineData.cs b/DungeonShooting_Godot/src/framework/coroutine/CoroutineData.cs index 03c678c..f520c08 100644 --- a/DungeonShooting_Godot/src/framework/coroutine/CoroutineData.cs +++ b/DungeonShooting_Godot/src/framework/coroutine/CoroutineData.cs @@ -9,7 +9,7 @@ /// public class CoroutineData { - private static long _id; + private static long _id = 1; public enum WaitTypeEnum { diff --git a/DungeonShooting_Godot/src/framework/ui/IUiNode.cs b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs index bf384b7..7e20a13 100644 --- a/DungeonShooting_Godot/src/framework/ui/IUiNode.cs +++ b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs @@ -6,7 +6,7 @@ /// /// Godot中的节点类型 /// 克隆该对象返回的类型 -public abstract class IUiNode where TNodeType : Node +public abstract class IUiNode : IClone where TNodeType : Node { /// /// Godot节点实例 diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs new file mode 100644 index 0000000..2870ffa --- /dev/null +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs @@ -0,0 +1,29 @@ + +using Godot; + +public abstract class UiCell : IDestroy where TNodeType : Node where TUiNodeType : IUiNode +{ + public bool IsDestroyed { get; private set; } + + public UiGrid Grid { get; set; } + public TUiNodeType CellNode { get; set; } + public T Data { get; set; } + + public virtual void OnInit() + { + } + + public virtual void OnSetData(T data) + { + } + + public void Destroy() + { + if (IsDestroyed) + { + return; + } + + IsDestroyed = true; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs new file mode 100644 index 0000000..2f7ef01 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs @@ -0,0 +1,113 @@ + + +using System; +using System.Collections.Generic; +using Godot; + +public partial class UiGrid : GridContainer, IDestroy where TNodeType : Node where TUiNodeType : IUiNode +{ + public bool IsDestroyed { get; private set; } + private TUiNodeType _template; + private Node _parent; + private Type _cellType; + private Stack> _cellPool = new Stack>(); + private List> _cellList = new List>(); + + public UiGrid(TUiNodeType template, Type cellType, int columns, int offsetX, int offsetY) + { + _template = template; + _cellType = cellType; + _parent = _template.Instance.GetParent(); + _parent.RemoveChild(_template.Instance); + _parent.AddChild(this); + Columns = columns; + AddThemeConstantOverride("h_separation", offsetX); + AddThemeConstantOverride("v_separation", offsetY); + } + + public override void _Ready() + { + if (_template.Instance is Control control) + { + Position = control.Position; + } + } + + public void SetDataList(TData[] array) + { + if (array.Length > _cellList.Count) + { + do + { + var cell = GetCellInstance(); + _cellList.Add(cell); + AddChild(cell.CellNode.Instance); + } while (array.Length > _cellList.Count); + } + else if(array.Length < _cellList.Count) + { + do + { + var cell = _cellList[_cellList.Count - 1]; + _cellList.RemoveAt(_cellList.Count - 1); + ReclaimCellInstance(cell); + } while (array.Length < _cellList.Count); + } + + for (var i = 0; i < _cellList.Count; i++) + { + var data = array[i]; + _cellList[i].OnSetData(data); + } + } + + public void Add(TData data) + { + var cell = GetCellInstance(); + _cellList.Add(cell); + AddChild(cell.CellNode.Instance); + cell.OnSetData(data); + } + + public void Destroy() + { + if (IsDestroyed) + { + return; + } + + IsDestroyed = true; + + for (var i = 0; i < _cellList.Count; i++) + { + _cellList[i].Destroy(); + } + foreach (var uiCell in _cellPool) + { + uiCell.Destroy(); + } + _cellList = null; + _cellPool = null; + } + + private UiCell GetCellInstance() + { + if (_cellPool.Count > 0) + { + return _cellPool.Pop(); + } + + var cell = Activator.CreateInstance(_cellType); + var uiCell = (UiCell)cell; + uiCell.CellNode = _template.Clone(); + uiCell.Grid = this; + uiCell.OnInit(); + return uiCell; + } + + private void ReclaimCellInstance(UiCell cell) + { + RemoveChild(cell.CellNode.Instance); + _cellPool.Push(cell); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/State.cs b/DungeonShooting_Godot/src/game/buff/State.cs new file mode 100644 index 0000000..cca36d1 --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/State.cs @@ -0,0 +1,5 @@ + +public class State +{ + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index e4e5b35..1c9126a 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -28,6 +28,8 @@ public const string prefab_role_Role0001_tscn = "res://prefab/role/Role0001.tscn"; public const string prefab_role_RoleTemplate_tscn = "res://prefab/role/RoleTemplate.tscn"; public const string prefab_shell_Shell0001_tscn = "res://prefab/shell/Shell0001.tscn"; + public const string prefab_shell_Shell0002_tscn = "res://prefab/shell/Shell0002.tscn"; + public const string prefab_shell_Shell0003_tscn = "res://prefab/shell/Shell0003.tscn"; public const string prefab_test_MoveComponent_tscn = "res://prefab/test/MoveComponent.tscn"; public const string prefab_test_TestActivity_tscn = "res://prefab/test/TestActivity.tscn"; public const string prefab_ui_EditorTools_tscn = "res://prefab/ui/EditorTools.tscn"; @@ -58,22 +60,22 @@ public const string resource_material_Blend_tres = "res://resource/material/Blend.tres"; public const string resource_material_SmokeParticleMaterial_tres = "res://resource/material/SmokeParticleMaterial.tres"; public const string resource_sound_bgm_Intro_ogg = "res://resource/sound/bgm/Intro.ogg"; - public const string resource_sound_sfx_equip_Equip0001_ogg = "res://resource/sound/sfx/equip/Equip0001.ogg"; - public const string resource_sound_sfx_equip_Equip0002_ogg = "res://resource/sound/sfx/equip/Equip0002.ogg"; - public const string resource_sound_sfx_equip_Equip0003_ogg = "res://resource/sound/sfx/equip/Equip0003.ogg"; - public const string resource_sound_sfx_equip_Equip0004_ogg = "res://resource/sound/sfx/equip/Equip0004.ogg"; - public const string resource_sound_sfx_equip_Equip0005_ogg = "res://resource/sound/sfx/equip/Equip0005.ogg"; - public const string resource_sound_sfx_equip_Equip0006_ogg = "res://resource/sound/sfx/equip/Equip0006.ogg"; - public const string resource_sound_sfx_equip_Equip0007_ogg = "res://resource/sound/sfx/equip/Equip0007.ogg"; - public const string resource_sound_sfx_equip_Equip0008_ogg = "res://resource/sound/sfx/equip/Equip0008.ogg"; - public const string resource_sound_sfx_equip_Equip0009_ogg = "res://resource/sound/sfx/equip/Equip0009.ogg"; - public const string resource_sound_sfx_equip_Equip0010_ogg = "res://resource/sound/sfx/equip/Equip0010.ogg"; - public const string resource_sound_sfx_equip_Equip0011_ogg = "res://resource/sound/sfx/equip/Equip0011.ogg"; - public const string resource_sound_sfx_equip_Equip0012_ogg = "res://resource/sound/sfx/equip/Equip0012.ogg"; - public const string resource_sound_sfx_equip_Equip0013_ogg = "res://resource/sound/sfx/equip/Equip0013.ogg"; - public const string resource_sound_sfx_equip_Equip0014_ogg = "res://resource/sound/sfx/equip/Equip0014.ogg"; - public const string resource_sound_sfx_equip_Equip0015_ogg = "res://resource/sound/sfx/equip/Equip0015.ogg"; - public const string resource_sound_sfx_equip_Equip0016_ogg = "res://resource/sound/sfx/equip/Equip0016.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0001_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0001.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0002_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0002.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0003_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0003.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0004_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0004.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0005_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0005.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0006_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0006.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0007_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0007.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0008_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0008.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0009_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0009.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0010_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0010.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0011_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0011.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0012_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0012.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0013_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0013.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0014_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0014.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0015_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0015.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0016_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0016.ogg"; public const string resource_sound_sfx_explosion_Explosion0001_ogg = "res://resource/sound/sfx/explosion/Explosion0001.ogg"; public const string resource_sound_sfx_explosion_Explosion0002_ogg = "res://resource/sound/sfx/explosion/Explosion0002.ogg"; public const string resource_sound_sfx_explosion_Explosion0003_ogg = "res://resource/sound/sfx/explosion/Explosion0003.ogg"; @@ -124,7 +126,9 @@ public const string resource_sprite_role_role9_png = "res://resource/sprite/role/role9.png"; public const string resource_sprite_role_enemy0001_Enemy0001_png = "res://resource/sprite/role/enemy0001/Enemy0001.png"; public const string resource_sprite_role_enemy0001_Enemy0001_Debris_png = "res://resource/sprite/role/enemy0001/Enemy0001_Debris.png"; - public const string resource_sprite_shell_shellCase_png = "res://resource/sprite/shell/shellCase.png"; + public const string resource_sprite_shell_Shell0001_png = "res://resource/sprite/shell/Shell0001.png"; + public const string resource_sprite_shell_Shell0002_png = "res://resource/sprite/shell/Shell0002.png"; + public const string resource_sprite_shell_Shell0003_png = "res://resource/sprite/shell/Shell0003.png"; public const string resource_sprite_ui_CursorCenter_png = "res://resource/sprite/ui/CursorCenter.png"; public const string resource_sprite_ui_cursors_png = "res://resource/sprite/ui/cursors.png"; public const string resource_sprite_ui_font_bg_png = "res://resource/sprite/ui/font_bg.png"; @@ -132,12 +136,17 @@ public const string resource_sprite_ui_healthBar_png = "res://resource/sprite/ui/healthBar.png"; public const string resource_sprite_ui_hpBar_png = "res://resource/sprite/ui/hpBar.png"; public const string resource_sprite_ui_hpSlot_png = "res://resource/sprite/ui/hpSlot.png"; + public const string resource_sprite_ui_Life_empty_png = "res://resource/sprite/ui/Life_empty.png"; + public const string resource_sprite_ui_Life_full_png = "res://resource/sprite/ui/Life_full.png"; + public const string resource_sprite_ui_Life_half_png = "res://resource/sprite/ui/Life_half.png"; public const string resource_sprite_ui_mapBar_png = "res://resource/sprite/ui/mapBar.png"; public const string resource_sprite_ui_reloadBar_png = "res://resource/sprite/ui/reloadBar.png"; public const string resource_sprite_ui_reloadBarBlock_png = "res://resource/sprite/ui/reloadBarBlock.png"; public const string resource_sprite_ui_RoomUi_png = "res://resource/sprite/ui/RoomUi.png"; public const string resource_sprite_ui_shieldBar_png = "res://resource/sprite/ui/shieldBar.png"; public const string resource_sprite_ui_shieldSlot_png = "res://resource/sprite/ui/shieldSlot.png"; + public const string resource_sprite_ui_Shield_empty_png = "res://resource/sprite/ui/Shield_empty.png"; + public const string resource_sprite_ui_Shield_full_png = "res://resource/sprite/ui/Shield_full.png"; public const string resource_sprite_ui_templateui_png = "res://resource/sprite/ui/template-ui.png"; public const string resource_sprite_ui_icon_icon_bullet_png = "res://resource/sprite/ui/icon/icon_bullet.png"; public const string resource_sprite_ui_icon_icon_pickup_png = "res://resource/sprite/ui/icon/icon_pickup.png"; @@ -167,6 +176,8 @@ public const string resource_spriteFrames_RoomDoor_EW_tres = "res://resource/spriteFrames/RoomDoor_EW.tres"; public const string resource_spriteFrames_RoomDoor_NS_tres = "res://resource/spriteFrames/RoomDoor_NS.tres"; public const string resource_spriteFrames_Shell0001_tres = "res://resource/spriteFrames/Shell0001.tres"; + public const string resource_spriteFrames_Shell0002_tres = "res://resource/spriteFrames/Shell0002.tres"; + public const string resource_spriteFrames_Shell0003_tres = "res://resource/spriteFrames/Shell0003.tres"; public const string resource_spriteFrames_Weapon0001_tres = "res://resource/spriteFrames/Weapon0001.tres"; public const string resource_spriteFrames_Weapon0002_tres = "res://resource/spriteFrames/Weapon0002.tres"; public const string resource_spriteFrames_Weapon0003_tres = "res://resource/spriteFrames/Weapon0003.tres"; diff --git a/DungeonShooting_Godot/src/game/role/Player.cs b/DungeonShooting_Godot/src/game/role/Player.cs index de9542c..cb58fc9 100644 --- a/DungeonShooting_Godot/src/game/role/Player.cs +++ b/DungeonShooting_Godot/src/game/role/Player.cs @@ -47,10 +47,10 @@ // MainCamera.Main.ResetSmoothing(); // remoteTransform.RemotePath = remoteTransform.GetPathTo(MainCamera.Main); - MaxHp = 50; - Hp = 50; - MaxShield = 30; - Shield = 30; + MaxHp = 6; + Hp = 6; + MaxShield = 2; + Shield = 2; // debug用 // Acceleration = 3000; @@ -141,6 +141,25 @@ PlayAnim(); } + protected override int OnHandlerHurt(int damage) + { + //修改受到的伤害, 每次只受到1点伤害 + return 1; + } + + protected override void OnHit(int damage, bool realHarm) + { + //进入无敌状态 + if (realHarm) //真实伤害 + { + PlayInvincibleFlashing(1.5f); + } + else //护盾抵消掉的 + { + PlayInvincibleFlashing(0.5f); + } + } + protected override void OnChangeHp(int hp) { //GameApplication.Instance.Ui.SetHp(hp); diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs index 79ca40f..10ebd64 100644 --- a/DungeonShooting_Godot/src/game/role/Role.cs +++ b/DungeonShooting_Godot/src/game/role/Role.cs @@ -1,3 +1,4 @@ +using System.Collections; using System.Collections.Generic; using Godot; @@ -117,7 +118,7 @@ int temp = _shield; _shield = value; //护盾被破坏 - if (temp > 0 && _shield <= 0) OnShieldDamage(); + if (temp > 0 && _shield <= 0) OnShieldDestroy(); //护盾值改变 if (temp != _shield) OnChangeShield(_shield); } @@ -140,6 +141,40 @@ private int _maxShield = 0; /// + /// 单格护盾恢复时间 + /// + private float ShieldRecoveryTime { get; set; } = 8; + + /// + /// 无敌状态 + /// + public bool Invincible + { + get => _invincible; + set + { + if (_invincible != value) + { + if (value) //无敌状态 + { + HurtArea.CollisionLayer = _currentLayer; + _flashingInvincibleTimer = -1; + _flashingInvincibleFlag = false; + } + else //正常状态 + { + HurtArea.CollisionLayer = _currentLayer; + SetBlendAlpha(1); + } + } + + _invincible = value; + } + } + + private bool _invincible = false; + + /// /// 当前角色所看向的对象, 也就是枪口指向的对象 /// public ActivityObject LookTarget { get; set; } @@ -150,6 +185,15 @@ private readonly List _interactiveItemList = new List(); private CheckInteractiveResult _tempResultData; + private uint _currentLayer; + //闪烁计时器 + private float _flashingInvincibleTimer = -1; + //闪烁状态 + private bool _flashingInvincibleFlag = false; + //闪烁动画协程id + private long _invincibleFlashingId = -1; + //护盾恢复计时器 + private float _shieldRecoveryTimer = 0; /// /// 可以互动的道具 @@ -187,7 +231,7 @@ /// /// 当护盾被破坏时调用 /// - protected virtual void OnShieldDamage() + protected virtual void OnShieldDestroy() { } @@ -195,11 +239,21 @@ /// 当受伤时调用 /// /// 受到的伤害 - protected virtual void OnHit(int damage) + /// 是否受到真实伤害, 如果为false, 则表示该伤害被互动格挡掉了 + protected virtual void OnHit(int damage, bool realHarm) { } /// + /// 受到伤害时调用, 用于改变受到的伤害值 + /// + /// 受到的伤害 + protected virtual int OnHandlerHurt(int damage) + { + return damage; + } + + /// /// 当可互动的物体改变时调用, result 参数为 null 表示变为不可互动 /// /// 检测是否可互动时的返回值 @@ -222,9 +276,10 @@ HurtArea.CollisionLayer = CollisionLayer; HurtArea.CollisionMask = 0; + _currentLayer = HurtArea.CollisionLayer; Face = FaceDirection.Right; - + //连接互动物体信号 InteractiveArea.BodyEntered += _OnPropsEnter; InteractiveArea.BodyExited += _OnPropsExit; @@ -288,6 +343,44 @@ InteractiveItem = null; ChangeInteractiveItem(null); } + + //无敌状态, 播放闪烁动画 + if (Invincible) + { + _flashingInvincibleTimer -= delta; + if (_flashingInvincibleTimer <= 0) + { + _flashingInvincibleTimer = 0.15f; + if (_flashingInvincibleFlag) + { + _flashingInvincibleFlag = false; + SetBlendAlpha(0.7f); + } + else + { + _flashingInvincibleFlag = true; + SetBlendAlpha(0); + } + } + + _shieldRecoveryTimer = 0; + } + else //恢复护盾 + { + if (Shield < MaxShield) + { + _shieldRecoveryTimer += delta; + if (_shieldRecoveryTimer >= ShieldRecoveryTime) //时间到, 恢复 + { + Shield++; + _shieldRecoveryTimer = 0; + } + } + else + { + _shieldRecoveryTimer = 0; + } + } } /// @@ -506,8 +599,21 @@ /// 角度 public virtual void Hurt(int damage, float angle) { - OnHit(damage); - if (Shield > 0) + //受伤闪烁, 无敌状态 + if (Invincible) + { + return; + } + + //计算真正受到的伤害 + damage = OnHandlerHurt(damage); + if (damage <= 0) + { + return; + } + + var flag = Shield > 0; + if (flag) { Shield -= damage; } @@ -521,6 +627,7 @@ // blood.Rotation = angle; // GameApplication.Instance.Node3D.GetRoot().AddChild(blood); } + OnHit(damage, !flag); //受伤特效 PlayHitAnimation(); @@ -538,6 +645,41 @@ } /// + /// 播放无敌状态闪烁动画 + /// + /// 持续时间 + public void PlayInvincibleFlashing(float time) + { + Invincible = true; + if (_invincibleFlashingId >= 0) //上一个还没结束 + { + StopCoroutine(_invincibleFlashingId); + } + + _invincibleFlashingId = StartCoroutine(RunInvincibleFlashing(time)); + } + + /// + /// 停止无敌状态闪烁动画 + /// + public void StopInvincibleFlashing() + { + Invincible = false; + if (_invincibleFlashingId >= 0) + { + StopCoroutine(_invincibleFlashingId); + _invincibleFlashingId = -1; + } + } + + private IEnumerator RunInvincibleFlashing(float time) + { + yield return new WaitForSeconds(time); + _invincibleFlashingId = -1; + Invincible = false; + } + + /// /// 设置脸的朝向 /// private void SetFace(FaceDirection face) diff --git a/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs index ffd076a..c28da7e 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs @@ -156,7 +156,7 @@ EnemyPickUpWeapon(); } - protected override void OnHit(int damage) + protected override void OnHit(int damage, bool realHarm) { //受到伤害 var state = StateController.CurrState; diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index b8d3ed1..f84968b 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -163,7 +163,7 @@ //打开游戏中的ui var roomUi = UiManager.Open_RoomUI(); - roomUi.InitData(player); + roomUi.InitData(); //派发进入地牢事件 EventManager.EmitEvent(EventEnum.OnEnterDungeon); diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/HealthBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/HealthBar.cs deleted file mode 100644 index 0f387b1..0000000 --- a/DungeonShooting_Godot/src/game/ui/roomUI/HealthBar.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using Godot; - -namespace UI.RoomUI; - -public class HealthBar -{ - private RoomUI.UiNode_HealthBar _healthBar; - // 当前血量 - private int _hp; - // 最大血量 - private int _maxHp; - // 当前护盾值 - private int _shield; - // 最大护盾值 - private int _maxShield; - - private EventFactory _eventFactory; - - public HealthBar(RoomUI.UiNode_HealthBar healthBar) - { - _healthBar = healthBar; - } - - public void OnShow() - { - _eventFactory = EventManager.CreateEventFactory(); - _eventFactory.AddEventListener(EventEnum.OnPlayerHpChange, OnPlayerHpChange); - _eventFactory.AddEventListener(EventEnum.OnPlayerMaxHpChange, OnPlayerMaxHpChange); - _eventFactory.AddEventListener(EventEnum.OnPlayerShieldChange, OnPlayerShieldChange); - _eventFactory.AddEventListener(EventEnum.OnPlayerMaxShieldChange, OnPlayerMaxShieldChange); - } - - public void OnHide() - { - _eventFactory.RemoveAllEventListener(); - } - - /// - /// 设置最大血量 - /// - public void SetMaxHp(int maxHp) - { - _maxHp = Mathf.Max(maxHp, 0); - _healthBar.L_HpSlot.Instance.Size = new Vector2(maxHp + 3, _healthBar.L_HpSlot.Instance.Size.Y); - if (_hp > maxHp) - { - SetHp(maxHp); - } - } - - /// - /// 设置最大护盾值 - /// - public void SetMaxShield(int maxShield) - { - _maxShield = Mathf.Max(maxShield, 0); - _healthBar.L_ShieldSlot.Instance.Size = new Vector2(maxShield + 2, _healthBar.L_ShieldSlot.Instance.Size.Y); - if (_shield > _maxShield) - { - SetShield(maxShield); - } - } - - /// - /// 设置当前血量 - /// - public void SetHp(int hp) - { - _hp = Mathf.Clamp(hp, 0, _maxHp); - var textureRect = _healthBar.L_HpSlot.L_HpBar.Instance; - textureRect.Size = new Vector2(hp, textureRect.Size.Y); - } - - /// - /// 设置护盾值 - /// - public void SetShield(int shield) - { - _shield = Mathf.Clamp(shield, 0, _maxShield); - var textureRect = _healthBar.L_ShieldSlot.L_ShieldBar.Instance; - textureRect.Size = new Vector2(shield, textureRect.Size.Y); - } - - private void OnPlayerHpChange(object o) - { - SetHp(Convert.ToInt32(o)); - } - - private void OnPlayerMaxHpChange(object o) - { - SetMaxHp(Convert.ToInt32(o)); - } - - private void OnPlayerShieldChange(object o) - { - SetShield(Convert.ToInt32(o)); - } - - private void OnPlayerMaxShieldChange(object o) - { - SetMaxShield(Convert.ToInt32(o)); - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs new file mode 100644 index 0000000..1b9df3c --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs @@ -0,0 +1,98 @@ +using System.Collections.Generic; +using Godot; + +namespace UI.RoomUI; + +public class LifeBar +{ + + private RoomUI.UiNode_LifeBar _bar; + private UiGrid _grid; + private EventFactory _eventFactory; + private bool _refreshFlag = false; + + public LifeBar(RoomUI.UiNode_LifeBar lifeBar) + { + _bar = lifeBar; + var uiNodeLife = lifeBar.L_Life; + + _grid = new UiGrid(uiNodeLife, typeof(LifeCell), 20, 1, 2); + + + // _grid.Add(LifeIconEnum.FullHeart); + // _grid.Add(LifeIconEnum.HalfHeart); + // _grid.Add(LifeIconEnum.EmptyHeart); + // _grid.Add(LifeIconEnum.FullShield); + // _grid.Add(LifeIconEnum.EmptyShield); + } + + public void OnShow() + { + _eventFactory = EventManager.CreateEventFactory(); + _eventFactory.AddEventListener(EventEnum.OnPlayerHpChange, o => RefreshLife()); + _eventFactory.AddEventListener(EventEnum.OnPlayerMaxHpChange, o => RefreshLife()); + _eventFactory.AddEventListener(EventEnum.OnPlayerShieldChange, o => RefreshLife()); + _eventFactory.AddEventListener(EventEnum.OnPlayerMaxShieldChange, o => RefreshLife()); + } + + public void OnHide() + { + _eventFactory.RemoveAllEventListener(); + } + + public void Process(float delta) + { + if (_refreshFlag) + { + _refreshFlag = false; + HandlerRefreshLife(); + } + } + + public void RefreshLife() + { + _refreshFlag = true; + } + + private void HandlerRefreshLife() + { + var player = Player.Current; + if (player.MaxHp % 2 != 0) + { + GD.PrintErr("玩家血量不是偶数!"); + } + + var list = new List(); + for (var i = 0; i < player.MaxHp / 2; i++) + { + if (player.Hp >= i * 2 + 2) + { + list.Add(LifeIconEnum.FullHeart); + } + else if (player.Hp >= i * 2 + 1) + { + list.Add(LifeIconEnum.HalfHeart); + } + else + { + list.Add(LifeIconEnum.EmptyHeart); + } + } + + for (var i = 0; i < player.MaxShield; i++) + { + if (player.Shield >= i + 1) + { + list.Add(LifeIconEnum.FullShield); + } + else + { + list.Add(LifeIconEnum.EmptyShield); + } + } + + //var maxHp + _grid.SetDataList(list.ToArray()); + } + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs new file mode 100644 index 0000000..c08cd65 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs @@ -0,0 +1,36 @@ +using Godot; + +namespace UI.RoomUI; + +public class LifeCell : UiCell +{ + private int _type = -1; + + public override void OnSetData(LifeIconEnum data) + { + if (_type == (int)data) + { + return; + } + + _type = (int)data; + switch (data) + { + case LifeIconEnum.FullHeart: + CellNode.Instance.Texture = ResourceManager.Load(ResourcePath.resource_sprite_ui_Life_full_png); + break; + case LifeIconEnum.HalfHeart: + CellNode.Instance.Texture = ResourceManager.Load(ResourcePath.resource_sprite_ui_Life_half_png); + break; + case LifeIconEnum.EmptyHeart: + CellNode.Instance.Texture = ResourceManager.Load(ResourcePath.resource_sprite_ui_Life_empty_png); + break; + case LifeIconEnum.FullShield: + CellNode.Instance.Texture = ResourceManager.Load(ResourcePath.resource_sprite_ui_Shield_full_png); + break; + case LifeIconEnum.EmptyShield: + CellNode.Instance.Texture = ResourceManager.Load(ResourcePath.resource_sprite_ui_Shield_empty_png); + break; + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeIconEnum.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeIconEnum.cs new file mode 100644 index 0000000..a2677cc --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeIconEnum.cs @@ -0,0 +1,25 @@ +namespace UI.RoomUI; + +public enum LifeIconEnum +{ + /// + /// 满心 + /// + FullHeart, + /// + /// 半心 + /// + HalfHeart, + /// + /// 空心 + /// + EmptyHeart, + /// + /// 满护盾 + /// + FullShield, + /// + /// 空护盾 + /// + EmptyShield, +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs index 042949b..f461396 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs @@ -178,100 +178,34 @@ } /// - /// 类型: , 路径: RoomUI.Control.HealthBar.HpSlot.HpBar + /// 类型: , 路径: RoomUI.Control.LifeBar.Life /// - public class UiNode_HpBar : IUiNode + public class UiNode_Life : IUiNode { - public UiNode_HpBar(Godot.TextureRect node) : base(node) { } - public override UiNode_HpBar Clone() => new ((Godot.TextureRect)Instance.Duplicate()); + public UiNode_Life(Godot.TextureRect node) : base(node) { } + public override UiNode_Life Clone() => new ((Godot.TextureRect)Instance.Duplicate()); } /// - /// 类型: , 路径: RoomUI.Control.HealthBar.HpSlot + /// 类型: , 路径: RoomUI.Control.LifeBar /// - public class UiNode_HpSlot : IUiNode + public class UiNode_LifeBar : IUiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.HealthBar.HpBar + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.Life /// - public UiNode_HpBar L_HpBar + public UiNode_Life L_Life { get { - if (_L_HpBar == null) _L_HpBar = new UiNode_HpBar(Instance.GetNodeOrNull("HpBar")); - return _L_HpBar; + if (_L_Life == null) _L_Life = new UiNode_Life(Instance.GetNodeOrNull("Life")); + return _L_Life; } } - private UiNode_HpBar _L_HpBar; + private UiNode_Life _L_Life; - public UiNode_HpSlot(Godot.NinePatchRect node) : base(node) { } - public override UiNode_HpSlot Clone() => new ((Godot.NinePatchRect)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: RoomUI.Control.HealthBar.ShieldSlot.ShieldBar - /// - public class UiNode_ShieldBar : IUiNode - { - public UiNode_ShieldBar(Godot.TextureRect node) : base(node) { } - public override UiNode_ShieldBar Clone() => new ((Godot.TextureRect)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: RoomUI.Control.HealthBar.ShieldSlot - /// - public class UiNode_ShieldSlot : IUiNode - { - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.HealthBar.ShieldBar - /// - public UiNode_ShieldBar L_ShieldBar - { - get - { - if (_L_ShieldBar == null) _L_ShieldBar = new UiNode_ShieldBar(Instance.GetNodeOrNull("ShieldBar")); - return _L_ShieldBar; - } - } - private UiNode_ShieldBar _L_ShieldBar; - - public UiNode_ShieldSlot(Godot.NinePatchRect node) : base(node) { } - public override UiNode_ShieldSlot Clone() => new ((Godot.NinePatchRect)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: RoomUI.Control.HealthBar - /// - public class UiNode_HealthBar : IUiNode - { - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.HpSlot - /// - public UiNode_HpSlot L_HpSlot - { - get - { - if (_L_HpSlot == null) _L_HpSlot = new UiNode_HpSlot(Instance.GetNodeOrNull("HpSlot")); - return _L_HpSlot; - } - } - private UiNode_HpSlot _L_HpSlot; - - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.Control.ShieldSlot - /// - public UiNode_ShieldSlot L_ShieldSlot - { - get - { - if (_L_ShieldSlot == null) _L_ShieldSlot = new UiNode_ShieldSlot(Instance.GetNodeOrNull("ShieldSlot")); - return _L_ShieldSlot; - } - } - private UiNode_ShieldSlot _L_ShieldSlot; - - public UiNode_HealthBar(Godot.TextureRect node) : base(node) { } - public override UiNode_HealthBar Clone() => new ((Godot.TextureRect)Instance.Duplicate()); + public UiNode_LifeBar(Godot.Control node) : base(node) { } + public override UiNode_LifeBar Clone() => new ((Godot.Control)Instance.Duplicate()); } /// @@ -342,17 +276,17 @@ public class UiNode_Control : IUiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.HealthBar + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.LifeBar /// - public UiNode_HealthBar L_HealthBar + public UiNode_LifeBar L_LifeBar { get { - if (_L_HealthBar == null) _L_HealthBar = new UiNode_HealthBar(Instance.GetNodeOrNull("HealthBar")); - return _L_HealthBar; + if (_L_LifeBar == null) _L_LifeBar = new UiNode_LifeBar(Instance.GetNodeOrNull("LifeBar")); + return _L_LifeBar; } } - private UiNode_HealthBar _L_HealthBar; + private UiNode_LifeBar _L_LifeBar; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.MapBar diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs index 795c3e7..7401d92 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUIPanel.cs @@ -1,5 +1,4 @@ -using System.Collections; using Godot; namespace UI.RoomUI; @@ -11,43 +10,41 @@ { private ReloadBar _reloadBar; private InteractiveTipBar _interactiveTipBar; - private HealthBar _healthBar; private GunBar _gunBar; + private LifeBar _lifeBar; public override void OnCreateUi() { _reloadBar = new ReloadBar(L_ReloadBar); _interactiveTipBar = new InteractiveTipBar(L_InteractiveTipBar); - _healthBar = new HealthBar(L_Control.L_HealthBar); _gunBar = new GunBar(L_Control.L_GunBar); + _lifeBar = new LifeBar(L_Control.L_LifeBar); } public override void OnShowUi() { _reloadBar.OnShow(); _interactiveTipBar.OnShow(); - _healthBar.OnShow(); _gunBar.OnShow(); + _lifeBar.OnShow(); } public override void OnHideUi() { _reloadBar.OnHide(); _interactiveTipBar.OnHide(); - _healthBar.OnHide(); _gunBar.OnHide(); + _lifeBar.OnHide(); } - public void InitData(Player player) + public void InitData() { - _healthBar.SetMaxHp(player.MaxHp); - _healthBar.SetHp(player.Hp); - _healthBar.SetMaxShield(player.MaxShield); - _healthBar.SetShield(player.Shield); + _lifeBar.RefreshLife(); } public override void Process(float delta) { _gunBar.Process(delta); + _lifeBar.Process(delta); } } \ No newline at end of file