diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx index 8b0e0b8..dbdd157 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 603d0e4..b2185d4 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 27f6dfd..bba5663 100644 --- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx Binary files differ diff --git a/DungeonShooting_Godot/prefab/FanCollisionShape.tscn b/DungeonShooting_Godot/prefab/FanCollisionShape.tscn deleted file mode 100644 index cf26c3a..0000000 --- a/DungeonShooting_Godot/prefab/FanCollisionShape.tscn +++ /dev/null @@ -1,4 +0,0 @@ -[gd_scene format=2] - -[node name="FanCollisionShape" type="CollisionPolygon2D"] -polygon = PackedVector2Array( 0, -10, 5, -9, 9, -5, 10, 0, 9, 5, 5, 9, 0, 10 ) diff --git a/DungeonShooting_Godot/prefab/effect/weapon/BulletDisappear.tscn b/DungeonShooting_Godot/prefab/effect/weapon/BulletDisappear.tscn index 54549a1..6572e0c 100644 --- a/DungeonShooting_Godot/prefab/effect/weapon/BulletDisappear.tscn +++ b/DungeonShooting_Godot/prefab/effect/weapon/BulletDisappear.tscn @@ -1,8 +1,8 @@ -[gd_scene load_steps=15 format=3] +[gd_scene load_steps=13 format=3 uid="uid://c6mmikwchwt"] [ext_resource type="Texture2D" uid="uid://d8ot2wrdoe4j" path="res://resource/sprite/effects/Explosion.png" id="1_qqm6c"] -[ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/effects/Smoke.png" id="1_ybsvf"] - +[ext_resource type="Texture2D" uid="uid://h7hkgbwj1li" path="res://resource/sprite/effects/common/Smoke.png" id="1_ybsvf"] +[ext_resource type="Script" path="res://src/game/effects/AutoDestroySprite.cs" id="2_l2qlq"] [sub_resource type="AtlasTexture" id="AtlasTexture_tscb3"] atlas = ExtResource("1_qqm6c") @@ -69,63 +69,15 @@ color = Color(0.909804, 0.909804, 0.909804, 0.380392) anim_offset_max = 1.0 -[sub_resource type="Animation" id="Animation_jnfgg"] -resource_name = "Start" -length = 0.3 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:emitting") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} -tracks/1/type = "method" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("..") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0.3), -"transitions": PackedFloat32Array(1), -"values": [{ -"args": [], -"method": &"queue_free" -}] -} - -[sub_resource type="Animation" id="Animation_yr61b"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:emitting") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_1spnw"] -_data = { -"RESET": SubResource("Animation_yr61b"), -"Start": SubResource("Animation_jnfgg") -} - -[node name="BulletDisappear" type="AnimatedSprite2D"] +[node name="BulletDisappear" type="AnimatedSprite2D" node_paths=PackedStringArray("Particles2D")] modulate = Color(1, 1, 1, 0.784314) z_index = -4 scale = Vector2(0.5, 0.5) sprite_frames = SubResource("SpriteFrames_ub3cw") autoplay = "default" +script = ExtResource("2_l2qlq") +DelayTime = 0.3 +Particles2D = [NodePath("GPUParticles2D")] [node name="GPUParticles2D" type="GPUParticles2D" parent="."] material = SubResource("CanvasItemMaterial_4bd3q") @@ -136,10 +88,3 @@ one_shot = true explosiveness = 0.9 fixed_fps = 20 - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -root_node = NodePath("../GPUParticles2D") -autoplay = "Start" -libraries = { -"": SubResource("AnimationLibrary_1spnw") -} diff --git a/DungeonShooting_Godot/prefab/effect/weapon/MeleeAttack1.tscn b/DungeonShooting_Godot/prefab/effect/weapon/MeleeAttack1.tscn index 5ba7c89..9d50730 100644 --- a/DungeonShooting_Godot/prefab/effect/weapon/MeleeAttack1.tscn +++ b/DungeonShooting_Godot/prefab/effect/weapon/MeleeAttack1.tscn @@ -1,31 +1,38 @@ -[gd_scene load_steps=7 format=3 uid="uid://cylm455bsio3g"] +[gd_scene load_steps=8 format=3 uid="uid://cylm455bsio3g"] [ext_resource type="Texture2D" uid="uid://7jhe2mmctmr1" path="res://resource/sprite/effects/weapon/MeleeAttack1.png" id="1_bjxle"] [ext_resource type="Script" path="res://src/game/effects/AutoDestroySprite.cs" id="2_bjagc"] -[sub_resource type="AtlasTexture" id="AtlasTexture_h5mw5"] +[sub_resource type="AtlasTexture" id="AtlasTexture_36t2o"] atlas = ExtResource("1_bjxle") -region = Rect2(0, 0, 16, 32) +region = Rect2(0, 0, 16, 38) -[sub_resource type="AtlasTexture" id="AtlasTexture_rjd0g"] +[sub_resource type="AtlasTexture" id="AtlasTexture_pwsgl"] atlas = ExtResource("1_bjxle") -region = Rect2(16, 0, 16, 32) +region = Rect2(16, 0, 16, 38) -[sub_resource type="AtlasTexture" id="AtlasTexture_q06ex"] +[sub_resource type="AtlasTexture" id="AtlasTexture_8lpt5"] atlas = ExtResource("1_bjxle") -region = Rect2(32, 0, 16, 32) +region = Rect2(32, 0, 16, 38) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ihg55"] +atlas = ExtResource("1_bjxle") +region = Rect2(48, 0, 16, 38) [sub_resource type="SpriteFrames" id="SpriteFrames_hkcv6"] animations = [{ "frames": [{ "duration": 1.0, -"texture": SubResource("AtlasTexture_h5mw5") +"texture": SubResource("AtlasTexture_36t2o") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_rjd0g") +"texture": SubResource("AtlasTexture_pwsgl") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_q06ex") +"texture": SubResource("AtlasTexture_8lpt5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ihg55") }], "loop": false, "name": &"default", @@ -36,4 +43,4 @@ sprite_frames = SubResource("SpriteFrames_hkcv6") autoplay = "default" script = ExtResource("2_bjagc") -DelayTime = 0.15 +DelayTime = 0.2 diff --git a/DungeonShooting_Godot/prefab/effect/weapon/MeleeAttack2.tscn b/DungeonShooting_Godot/prefab/effect/weapon/MeleeAttack2.tscn new file mode 100644 index 0000000..3796f4a --- /dev/null +++ b/DungeonShooting_Godot/prefab/effect/weapon/MeleeAttack2.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=3 uid="uid://cxq8wfeda4huc"] + +[ext_resource type="SpriteFrames" uid="uid://dj8o7ws03bik4" path="res://resource/spriteFrames/effect/KnifeHit1.tres" id="1_ds7pw"] +[ext_resource type="Script" path="res://src/game/effects/AutoDestroySprite.cs" id="2_hl3gp"] + +[node name="MeleeAttack2" type="AnimatedSprite2D"] +sprite_frames = ExtResource("1_ds7pw") +autoplay = "default" +script = ExtResource("2_hl3gp") +DelayTime = 0.12 diff --git a/DungeonShooting_Godot/prefab/role/Enemy0001.tscn b/DungeonShooting_Godot/prefab/role/Enemy0001.tscn index 6d6eeaf..46e01b2 100644 --- a/DungeonShooting_Godot/prefab/role/Enemy0001.tscn +++ b/DungeonShooting_Godot/prefab/role/Enemy0001.tscn @@ -25,7 +25,7 @@ shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false -[node name="Enemy0001" node_paths=PackedStringArray("HurtArea", "HurtCollision", "MountPoint", "BackMountPoint", "InteractiveArea", "InteractiveCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_5po38")] +[node name="Enemy0001" node_paths=PackedStringArray("HurtArea", "HurtCollision", "MountPoint", "BackMountPoint", "InteractiveArea", "InteractiveCollision", "MeleeAttackArea", "MeleeAttackCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_5po38")] collision_layer = 16 collision_mask = 25 script = ExtResource("2_1plrq") @@ -35,6 +35,8 @@ BackMountPoint = NodePath("BackMountPoint") InteractiveArea = NodePath("InteractiveArea") InteractiveCollision = NodePath("InteractiveArea/InteractiveCollision") +MeleeAttackArea = NodePath("MountPoint/MeleeAttackArea") +MeleeAttackCollision = NodePath("MountPoint/MeleeAttackArea/MeleeAttackCollision") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") diff --git a/DungeonShooting_Godot/prefab/role/Role0001.tscn b/DungeonShooting_Godot/prefab/role/Role0001.tscn index b8e436d..3da3053 100644 --- a/DungeonShooting_Godot/prefab/role/Role0001.tscn +++ b/DungeonShooting_Godot/prefab/role/Role0001.tscn @@ -25,7 +25,7 @@ shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false -[node name="Role0001" node_paths=PackedStringArray("HurtArea", "HurtCollision", "MountPoint", "BackMountPoint", "InteractiveArea", "InteractiveCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_10c2n")] +[node name="Role0001" node_paths=PackedStringArray("HurtArea", "HurtCollision", "MountPoint", "BackMountPoint", "InteractiveArea", "InteractiveCollision", "MeleeAttackArea", "MeleeAttackCollision", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_10c2n")] collision_layer = 8 script = ExtResource("2_6xwnt") HurtArea = NodePath("HurtArea") @@ -34,6 +34,8 @@ BackMountPoint = NodePath("BackMountPoint") InteractiveArea = NodePath("InteractiveArea") InteractiveCollision = NodePath("InteractiveArea/InteractiveCollision") +MeleeAttackArea = NodePath("MountPoint/MeleeAttackArea") +MeleeAttackCollision = NodePath("MountPoint/MeleeAttackArea/MeleeAttackCollision") ShadowSprite = NodePath("ShadowSprite") AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") diff --git a/DungeonShooting_Godot/prefab/role/RoleTemplate.tscn b/DungeonShooting_Godot/prefab/role/RoleTemplate.tscn index 2217fee..559a842 100644 --- a/DungeonShooting_Godot/prefab/role/RoleTemplate.tscn +++ b/DungeonShooting_Godot/prefab/role/RoleTemplate.tscn @@ -71,3 +71,10 @@ [node name="MountPoint" type="Marker2D" parent="."] position = Vector2(2, -8) script = ExtResource("2_5ddpw") + +[node name="MeleeAttackArea" type="Area2D" parent="MountPoint"] +collision_layer = 0 +collision_mask = 0 +monitorable = false + +[node name="MeleeAttackCollision" type="CollisionPolygon2D" parent="MountPoint/MeleeAttackArea"] diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn index 2a88133..05a83fb 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0001.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=3 uid="uid://c6etppq4v63xw"] +[gd_scene load_steps=8 format=3 uid="uid://c6etppq4v63xw"] [ext_resource type="PackedScene" uid="uid://cxltmhhp4rbyk" path="res://prefab/weapon/WeaponTemplate.tscn" id="1_ykl0r"] [ext_resource type="Script" path="res://src/game/activity/weapon/gun/Gun.cs" id="2_t56pk"] @@ -25,6 +25,9 @@ shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false +[sub_resource type="RectangleShape2D" id="RectangleShape2D_7i6da"] +size = Vector2(22, 8.25) + [node name="Weapon0001" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_ykl0r")] script = ExtResource("2_t56pk") FirePoint = NodePath("AnimatedSprite/FirePoint") @@ -50,3 +53,7 @@ [node name="GripPoint" parent="." index="2"] position = Vector2(-5, -1) + +[node name="Collision" parent="." index="3"] +position = Vector2(0, -0.875) +shape = SubResource("RectangleShape2D_7i6da") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn index 0942b19..0d01b8d 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0002.tscn @@ -1,64 +1,34 @@ -[gd_scene load_steps=10 format=3 uid="uid://doj2eilx1xtxf"] +[gd_scene load_steps=8 format=3 uid="uid://xutp8hlrwuxd"] [ext_resource type="Script" path="res://src/game/activity/weapon/gun/Gun.cs" id="1_hgtyo"] +[ext_resource type="PackedScene" uid="uid://cxltmhhp4rbyk" path="res://prefab/weapon/WeaponTemplate.tscn" id="1_r50xc"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_8nvny"] [ext_resource type="SpriteFrames" uid="uid://domhmo4flmlt0" path="res://resource/spriteFrames/weapon/Weapon0002.tres" id="3_4h3je"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_cbiyh"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_bywvu"] resource_local_to_scene = true shader = ExtResource("2_8nvny") shader_parameter/blend = Color(0, 0, 0, 0.470588) shader_parameter/schedule = 1.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false -[sub_resource type="ShaderMaterial" id="ShaderMaterial_o36tv"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_llqbm"] resource_local_to_scene = true shader = ExtResource("2_8nvny") shader_parameter/blend = Color(1, 1, 1, 1) shader_parameter/schedule = 0.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false -[sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] -size = Vector2(19.5, 8.75) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_aymlx"] +size = Vector2(18, 6) -[sub_resource type="Animation" id="Animation_x136i"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0] -} - -[sub_resource type="Animation" id="Animation_3piau"] -resource_name = "floodlight" -length = 3.0 -loop_mode = 1 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 2.3, 2.6, 2.7, 3), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 0, -"values": [0, 0, 0.5, 0.5, 0] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_trkjd"] -_data = { -"RESET": SubResource("Animation_x136i"), -"floodlight": SubResource("Animation_3piau") -} - -[node name="Weapon0002" type="CharacterBody2D" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision")] -collision_layer = 4 +[node name="Weapon0002" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_r50xc")] script = ExtResource("1_hgtyo") FirePoint = NodePath("AnimatedSprite/FirePoint") ShellPoint = NodePath("AnimatedSprite/ShellPoint") @@ -68,28 +38,22 @@ AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") -[node name="ShadowSprite" type="Sprite2D" parent="."] -z_index = -1 -material = SubResource("ShaderMaterial_cbiyh") +[node name="ShadowSprite" parent="." index="0"] +material = SubResource("ShaderMaterial_bywvu") -[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] -material = SubResource("ShaderMaterial_o36tv") +[node name="AnimatedSprite" parent="." index="1"] +material = SubResource("ShaderMaterial_llqbm") sprite_frames = ExtResource("3_4h3je") -animation = &"beLoaded" -[node name="ShellPoint" type="Marker2D" parent="AnimatedSprite"] +[node name="ShellPoint" parent="AnimatedSprite" index="0"] position = Vector2(-3, -2) -[node name="FirePoint" type="Marker2D" parent="AnimatedSprite"] -position = Vector2(12, -2) +[node name="FirePoint" parent="AnimatedSprite" index="1"] +position = Vector2(11.5, -2) -[node name="GripPoint" type="Marker2D" parent="."] +[node name="GripPoint" parent="." index="2"] position = Vector2(-10, 1) -[node name="Collision" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_3p5jk") - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_trkjd") -} +[node name="Collision" parent="." index="3"] +position = Vector2(0, 1) +shape = SubResource("RectangleShape2D_aymlx") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn index 18e0dd4..8575621 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0003.tscn @@ -1,65 +1,34 @@ -[gd_scene load_steps=10 format=3 uid="uid://dqy4trli5wcms"] +[gd_scene load_steps=8 format=3 uid="uid://bqp56e0f7kqn0"] [ext_resource type="Script" path="res://src/game/activity/weapon/gun/Gun.cs" id="1_aeolk"] +[ext_resource type="PackedScene" uid="uid://cxltmhhp4rbyk" path="res://prefab/weapon/WeaponTemplate.tscn" id="1_c17wt"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_4yjnk"] [ext_resource type="SpriteFrames" uid="uid://c7dt1uwdybn5" path="res://resource/spriteFrames/weapon/Weapon0003.tres" id="3_upkjt"] - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_cbiyh"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_c6pgc"] resource_local_to_scene = true shader = ExtResource("2_4yjnk") shader_parameter/blend = Color(0, 0, 0, 0.470588) shader_parameter/schedule = 1.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false -[sub_resource type="ShaderMaterial" id="ShaderMaterial_o36tv"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_kp0pp"] resource_local_to_scene = true shader = ExtResource("2_4yjnk") shader_parameter/blend = Color(1, 1, 1, 1) shader_parameter/schedule = 0.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false -[sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] -size = Vector2(14, 8) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_tlu5a"] +size = Vector2(12, 7) -[sub_resource type="Animation" id="Animation_x136i"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0] -} - -[sub_resource type="Animation" id="Animation_3piau"] -resource_name = "floodlight" -length = 3.0 -loop_mode = 1 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 2.3, 2.6, 2.7, 3), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 0, -"values": [0, 0, 0.5, 0.5, 0] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_trkjd"] -_data = { -"RESET": SubResource("Animation_x136i"), -"floodlight": SubResource("Animation_3piau") -} - -[node name="Weapon0003" type="CharacterBody2D" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision")] -collision_layer = 4 +[node name="Weapon0003" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_c17wt")] script = ExtResource("1_aeolk") FirePoint = NodePath("AnimatedSprite/FirePoint") ShellPoint = NodePath("AnimatedSprite/ShellPoint") @@ -69,27 +38,22 @@ AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") -[node name="ShadowSprite" type="Sprite2D" parent="."] -z_index = -1 -material = SubResource("ShaderMaterial_cbiyh") +[node name="ShadowSprite" parent="." index="0"] +material = SubResource("ShaderMaterial_c6pgc") -[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] -material = SubResource("ShaderMaterial_o36tv") +[node name="AnimatedSprite" parent="." index="1"] +material = SubResource("ShaderMaterial_kp0pp") sprite_frames = ExtResource("3_upkjt") -[node name="ShellPoint" type="Marker2D" parent="AnimatedSprite"] +[node name="ShellPoint" parent="AnimatedSprite" index="0"] position = Vector2(0, -3) -[node name="FirePoint" type="Marker2D" parent="AnimatedSprite"] -position = Vector2(9, -2) +[node name="FirePoint" parent="AnimatedSprite" index="1"] +position = Vector2(8, -2) -[node name="GripPoint" type="Marker2D" parent="."] +[node name="GripPoint" parent="." index="2"] position = Vector2(-4, 0) -[node name="Collision" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_3p5jk") - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_trkjd") -} +[node name="Collision" parent="." index="3"] +position = Vector2(-1, 0) +shape = SubResource("RectangleShape2D_tlu5a") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn index dde6dec..cbedbe7 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0004.tscn @@ -4,20 +4,29 @@ [ext_resource type="Script" path="res://src/game/activity/weapon/knife/Knife.cs" id="2_v1wer"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="3_63s5g"] [ext_resource type="SpriteFrames" uid="uid://k2tktysa7j86" path="res://resource/spriteFrames/weapon/Weapon0004.tres" id="4_uymcs"] -[ext_resource type="PackedScene" path="res://prefab/FanCollisionShape.tscn" id="5_nr15b"] - [sub_resource type="ShaderMaterial" id="ShaderMaterial_o5ytq"] resource_local_to_scene = true shader = ExtResource("3_63s5g") shader_parameter/blend = Color(0, 0, 0, 0.470588) shader_parameter/schedule = 1.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false [sub_resource type="ShaderMaterial" id="ShaderMaterial_rtliw"] resource_local_to_scene = true shader = ExtResource("3_63s5g") shader_parameter/blend = Color(1, 1, 1, 1) shader_parameter/schedule = 0.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_yks6x"] +size = Vector2(26, 2) [node name="Weapon0004" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_kg172")] script = ExtResource("2_v1wer") @@ -36,13 +45,19 @@ material = SubResource("ShaderMaterial_rtliw") sprite_frames = ExtResource("4_uymcs") +[node name="ShellPoint" parent="AnimatedSprite" index="0"] +position = Vector2(0, -1) + +[node name="FirePoint" parent="AnimatedSprite" index="1"] +position = Vector2(12, -1) + [node name="GripPoint" parent="." index="2"] position = Vector2(-12, -1) +[node name="Collision" parent="." index="3"] +position = Vector2(-1, -1) +shape = SubResource("RectangleShape2D_yks6x") + [node name="HitArea" type="Area2D" parent="." index="4"] monitoring = false monitorable = false - -[node name="FanCollisionShape" parent="HitArea" index="0" instance=ExtResource("5_nr15b")] -rotation = -1.5708 -scale = Vector2(3, 3) diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn index f9f1911..1fbae52 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0005.tscn @@ -1,65 +1,34 @@ -[gd_scene load_steps=10 format=3 uid="uid://cisivapjn5rq2"] +[gd_scene load_steps=8 format=3 uid="uid://bwhi5e52wiiay"] [ext_resource type="Script" path="res://src/game/activity/weapon/gun/Gun.cs" id="1_3lu3r"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="1_466gw"] +[ext_resource type="PackedScene" uid="uid://cxltmhhp4rbyk" path="res://prefab/weapon/WeaponTemplate.tscn" id="1_lyhyf"] [ext_resource type="SpriteFrames" uid="uid://djdvlmqsn8bie" path="res://resource/spriteFrames/weapon/Weapon0005.tres" id="2_m3plc"] - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_cbiyh"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_uftuv"] resource_local_to_scene = true shader = ExtResource("1_466gw") shader_parameter/blend = Color(0, 0, 0, 0.470588) shader_parameter/schedule = 1.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false -[sub_resource type="ShaderMaterial" id="ShaderMaterial_o36tv"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_irvr4"] resource_local_to_scene = true shader = ExtResource("1_466gw") shader_parameter/blend = Color(1, 1, 1, 1) shader_parameter/schedule = 0.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false -[sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] -size = Vector2(26, 8) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_opiwr"] +size = Vector2(28, 8) -[sub_resource type="Animation" id="Animation_x136i"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0] -} - -[sub_resource type="Animation" id="Animation_3piau"] -resource_name = "floodlight" -length = 3.0 -loop_mode = 1 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 2.3, 2.6, 2.7, 3), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 0, -"values": [0, 0, 0.5, 0.5, 0] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_trkjd"] -_data = { -"RESET": SubResource("Animation_x136i"), -"floodlight": SubResource("Animation_3piau") -} - -[node name="Weapon0005" type="CharacterBody2D" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision")] -collision_layer = 4 +[node name="Weapon0005" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_lyhyf")] script = ExtResource("1_3lu3r") FirePoint = NodePath("AnimatedSprite/FirePoint") ShellPoint = NodePath("AnimatedSprite/ShellPoint") @@ -69,27 +38,22 @@ AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") -[node name="ShadowSprite" type="Sprite2D" parent="."] -z_index = -1 -material = SubResource("ShaderMaterial_cbiyh") +[node name="ShadowSprite" parent="." index="0"] +material = SubResource("ShaderMaterial_uftuv") -[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] -material = SubResource("ShaderMaterial_o36tv") +[node name="AnimatedSprite" parent="." index="1"] +material = SubResource("ShaderMaterial_irvr4") sprite_frames = ExtResource("2_m3plc") -[node name="ShellPoint" type="Marker2D" parent="AnimatedSprite"] +[node name="ShellPoint" parent="AnimatedSprite" index="0"] position = Vector2(-1, -3.5) -[node name="FirePoint" type="Marker2D" parent="AnimatedSprite"] +[node name="FirePoint" parent="AnimatedSprite" index="1"] position = Vector2(20, -3.5) -[node name="GripPoint" type="Marker2D" parent="."] +[node name="GripPoint" parent="." index="2"] position = Vector2(-9, 0) -[node name="Collision" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_3p5jk") - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_trkjd") -} +[node name="Collision" parent="." index="3"] +position = Vector2(-1, 0) +shape = SubResource("RectangleShape2D_opiwr") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn index 2a5a07b..2b9639a 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0006.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=10 format=3 uid="uid://uydtgdanj0kx"] +[gd_scene load_steps=8 format=3 uid="uid://bg7ggha8wqys6"] [ext_resource type="Script" path="res://src/game/activity/weapon/gun/Gun.cs" id="1_5nx8j"] +[ext_resource type="PackedScene" uid="uid://cxltmhhp4rbyk" path="res://prefab/weapon/WeaponTemplate.tscn" id="1_kx4jd"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="1_rp1bw"] [ext_resource type="SpriteFrames" uid="uid://dx1mjbx4acs3q" path="res://resource/spriteFrames/weapon/Weapon0006.tres" id="2_j3sji"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_cbiyh"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_m6bme"] resource_local_to_scene = true shader = ExtResource("1_rp1bw") shader_parameter/blend = Color(0, 0, 0, 0.470588) @@ -14,7 +15,7 @@ shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false -[sub_resource type="ShaderMaterial" id="ShaderMaterial_o36tv"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_fqjj0"] resource_local_to_scene = true shader = ExtResource("1_rp1bw") shader_parameter/blend = Color(1, 1, 1, 1) @@ -24,49 +25,10 @@ shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false -[sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] -size = Vector2(12, 10) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_iq77m"] +size = Vector2(12, 8) -[sub_resource type="Animation" id="Animation_x136i"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0] -} - -[sub_resource type="Animation" id="Animation_3piau"] -resource_name = "floodlight" -length = 3.0 -loop_mode = 1 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 2.3, 2.6, 2.7, 3), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 0, -"values": [0, 0, 0.5, 0.5, 0] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_trkjd"] -_data = { -"RESET": SubResource("Animation_x136i"), -"floodlight": SubResource("Animation_3piau") -} - -[node name="Weapon0006" type="CharacterBody2D" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision")] -collision_layer = 4 +[node name="Weapon0006" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_kx4jd")] script = ExtResource("1_5nx8j") FirePoint = NodePath("AnimatedSprite/FirePoint") ShellPoint = NodePath("AnimatedSprite/ShellPoint") @@ -76,27 +38,22 @@ AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") -[node name="ShadowSprite" type="Sprite2D" parent="."] -z_index = -1 -material = SubResource("ShaderMaterial_cbiyh") +[node name="ShadowSprite" parent="." index="0"] +material = SubResource("ShaderMaterial_m6bme") -[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] -material = SubResource("ShaderMaterial_o36tv") +[node name="AnimatedSprite" parent="." index="1"] +material = SubResource("ShaderMaterial_fqjj0") sprite_frames = ExtResource("2_j3sji") -[node name="ShellPoint" type="Marker2D" parent="AnimatedSprite"] +[node name="ShellPoint" parent="AnimatedSprite" index="0"] position = Vector2(-3, -2.5) -[node name="FirePoint" type="Marker2D" parent="AnimatedSprite"] +[node name="FirePoint" parent="AnimatedSprite" index="1"] position = Vector2(8, -2.5) -[node name="GripPoint" type="Marker2D" parent="."] +[node name="GripPoint" parent="." index="2"] position = Vector2(-4, 1) -[node name="Collision" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_3p5jk") - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_trkjd") -} +[node name="Collision" parent="." index="3"] +position = Vector2(-1, 0) +shape = SubResource("RectangleShape2D_iq77m") diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon0007.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon0007.tscn index 4277b9a..0467857 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon0007.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon0007.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=10 format=3 uid="uid://btd0wc11ajcuo"] +[gd_scene load_steps=8 format=3 uid="uid://cgbggnmxoi251"] +[ext_resource type="PackedScene" uid="uid://cxltmhhp4rbyk" path="res://prefab/weapon/WeaponTemplate.tscn" id="1_5xnlm"] [ext_resource type="Script" path="res://src/game/activity/weapon/gun/Gun.cs" id="1_exwbu"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_7rywx"] [ext_resource type="SpriteFrames" uid="uid://xxyokrbt10xm" path="res://resource/spriteFrames/weapon/Weapon0007.tres" id="3_ms2gs"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_cbiyh"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_sy2aq"] resource_local_to_scene = true shader = ExtResource("2_7rywx") shader_parameter/blend = Color(0, 0, 0, 0.470588) @@ -14,7 +15,7 @@ shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false -[sub_resource type="ShaderMaterial" id="ShaderMaterial_o36tv"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_277ni"] resource_local_to_scene = true shader = ExtResource("2_7rywx") shader_parameter/blend = Color(1, 1, 1, 1) @@ -24,49 +25,10 @@ shader_parameter/outline_color = Color(0, 0, 0, 1) shader_parameter/outline_rainbow = false -[sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] -size = Vector2(12, 10) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_4pn1i"] +size = Vector2(20, 6) -[sub_resource type="Animation" id="Animation_x136i"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0] -} - -[sub_resource type="Animation" id="Animation_3piau"] -resource_name = "floodlight" -length = 3.0 -loop_mode = 1 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AnimatedSprite:material:shader_parameter/schedule") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 2.3, 2.6, 2.7, 3), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 0, -"values": [0, 0, 0.5, 0.5, 0] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_trkjd"] -_data = { -"RESET": SubResource("Animation_x136i"), -"floodlight": SubResource("Animation_3piau") -} - -[node name="Weapon0007" type="CharacterBody2D" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision")] -collision_layer = 4 +[node name="Weapon0007" node_paths=PackedStringArray("FirePoint", "ShellPoint", "GripPoint", "AnimationPlayer", "ShadowSprite", "AnimatedSprite", "Collision") instance=ExtResource("1_5xnlm")] script = ExtResource("1_exwbu") FirePoint = NodePath("AnimatedSprite/FirePoint") ShellPoint = NodePath("AnimatedSprite/ShellPoint") @@ -76,27 +38,21 @@ AnimatedSprite = NodePath("AnimatedSprite") Collision = NodePath("Collision") -[node name="ShadowSprite" type="Sprite2D" parent="."] -z_index = -1 -material = SubResource("ShaderMaterial_cbiyh") +[node name="ShadowSprite" parent="." index="0"] +material = SubResource("ShaderMaterial_sy2aq") -[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] -material = SubResource("ShaderMaterial_o36tv") +[node name="AnimatedSprite" parent="." index="1"] +material = SubResource("ShaderMaterial_277ni") sprite_frames = ExtResource("3_ms2gs") -[node name="ShellPoint" type="Marker2D" parent="AnimatedSprite"] -position = Vector2(-1, -3) +[node name="ShellPoint" parent="AnimatedSprite" index="0"] +position = Vector2(-2, -3) -[node name="FirePoint" type="Marker2D" parent="AnimatedSprite"] +[node name="FirePoint" parent="AnimatedSprite" index="1"] position = Vector2(13, -3) -[node name="GripPoint" type="Marker2D" parent="."] +[node name="GripPoint" parent="." index="2"] position = Vector2(-6, 0) -[node name="Collision" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_3p5jk") - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_trkjd") -} +[node name="Collision" parent="." index="3"] +shape = SubResource("RectangleShape2D_4pn1i") diff --git a/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn b/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn index 254e507..81179a1 100644 --- a/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn +++ b/DungeonShooting_Godot/prefab/weapon/WeaponTemplate.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://cxltmhhp4rbyk"] +[gd_scene load_steps=7 format=3 uid="uid://cxltmhhp4rbyk"] [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="1_3p8rg"] @@ -7,15 +7,20 @@ shader = ExtResource("1_3p8rg") shader_parameter/blend = Color(0, 0, 0, 0.470588) shader_parameter/schedule = 1.0 +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false [sub_resource type="ShaderMaterial" id="ShaderMaterial_o36tv"] resource_local_to_scene = true shader = ExtResource("1_3p8rg") shader_parameter/blend = Color(1, 1, 1, 1) shader_parameter/schedule = 0.0 - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_3p5jk"] -size = Vector2(19.5, 8.75) +shader_parameter/modulate = Color(1, 1, 1, 1) +shader_parameter/show_outline = true +shader_parameter/outline_color = Color(0, 0, 0, 1) +shader_parameter/outline_rainbow = false [sub_resource type="Animation" id="Animation_x136i"] length = 0.001 @@ -74,7 +79,6 @@ [node name="GripPoint" type="Marker2D" parent="."] [node name="Collision" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_3p5jk") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { diff --git a/DungeonShooting_Godot/resource/config/Weapon.json b/DungeonShooting_Godot/resource/config/Weapon.json index 1bf292c..57bbf71 100644 --- a/DungeonShooting_Godot/resource/config/Weapon.json +++ b/DungeonShooting_Godot/resource/config/Weapon.json @@ -37,6 +37,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 2, "BacklashRange": [ 2, 4 @@ -46,9 +47,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -68,8 +72,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0005", "__BeginReloadSound": "reloadBegin0004", @@ -124,6 +130,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 2, "BacklashRange": [ 2, 4 @@ -133,9 +140,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -155,8 +165,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0005", "__BeginReloadSound": "reloadBegin0004", @@ -211,6 +223,7 @@ "ScatteringRangeAddValue": 20, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 5, 6 @@ -220,9 +233,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0002", - "BulletHarmRange": [ + "HarmRange": [ 4 ], + "RepelRnage": [ + 30 + ], "BulletDeviationAngleRange": [ -10, 10 @@ -243,8 +259,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0003", "__BeginReloadSound": "reloadBegin0002", @@ -299,6 +317,7 @@ "ScatteringRangeAddValue": 20, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 5, 6 @@ -308,9 +327,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0002", - "BulletHarmRange": [ + "HarmRange": [ 4 ], + "RepelRnage": [ + 30 + ], "BulletDeviationAngleRange": [ -10, 10 @@ -331,8 +353,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0003", "__BeginReloadSound": "reloadBegin0002", @@ -387,6 +411,7 @@ "ScatteringRangeAddValue": 4, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 3, 5 @@ -396,9 +421,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -418,8 +446,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0004", "__BeginReloadSound": "reloading0001", @@ -474,6 +504,7 @@ "ScatteringRangeAddValue": 4, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.5, + "CameraShake": 4, "BacklashRange": [ 3, 5 @@ -483,9 +514,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 4 ], + "RepelRnage": [ + 20 + ], "BulletDeviationAngleRange": [ 0 ], @@ -505,8 +539,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0004", "__BeginReloadSound": "reloading0001", @@ -561,6 +597,7 @@ "ScatteringRangeAddValue": 0, "ScatteringRangeBackSpeed": 0, "ScatteringRangeBackDelayTime": 0, + "CameraShake": 7, "BacklashRange": [ -8 ], @@ -569,9 +606,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 25 ], + "RepelRnage": [ + 150 + ], "BulletDeviationAngleRange": [ 0 ], @@ -589,8 +629,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "", "__BeginReloadSound": "", @@ -645,6 +687,7 @@ "ScatteringRangeAddValue": 0, "ScatteringRangeBackSpeed": 0, "ScatteringRangeBackDelayTime": 0, + "CameraShake": 7, "BacklashRange": [ -8 ], @@ -653,9 +696,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 25 ], + "RepelRnage": [ + 150 + ], "BulletDeviationAngleRange": [ 0 ], @@ -673,8 +719,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "", "__BeginReloadSound": "", @@ -729,6 +777,7 @@ "ScatteringRangeAddValue": 40, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.8, + "CameraShake": 5, "BacklashRange": [ 5, 7 @@ -738,9 +787,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 30 ], + "RepelRnage": [ + 250 + ], "BulletDeviationAngleRange": [ 0 ], @@ -760,8 +812,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0008", "__BeginReloadSound": "reloadBegin0009", @@ -816,6 +870,7 @@ "ScatteringRangeAddValue": 40, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.8, + "CameraShake": 5, "BacklashRange": [ 5, 7 @@ -825,9 +880,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0001", - "BulletHarmRange": [ + "HarmRange": [ 30 ], + "RepelRnage": [ + 250 + ], "BulletDeviationAngleRange": [ 0 ], @@ -847,8 +905,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0008", "__BeginReloadSound": "reloadBegin0009", @@ -903,6 +963,7 @@ "ScatteringRangeAddValue": 2, "ScatteringRangeBackSpeed": 40, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -912,9 +973,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0002", - "BulletHarmRange": [ + "HarmRange": [ 3 ], + "RepelRnage": [ + 10 + ], "BulletDeviationAngleRange": [ 0 ], @@ -934,8 +998,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0002", "__BeginReloadSound": "reloadBegin0005", @@ -990,6 +1056,7 @@ "ScatteringRangeAddValue": 2, "ScatteringRangeBackSpeed": 30, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -999,9 +1066,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0002", - "BulletHarmRange": [ + "HarmRange": [ 3 ], + "RepelRnage": [ + 10 + ], "BulletDeviationAngleRange": [ 0 ], @@ -1021,8 +1091,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0002", "__BeginReloadSound": "reloadBegin0005", @@ -1077,6 +1149,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 50, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -1086,9 +1159,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0003", - "BulletHarmRange": [ + "HarmRange": [ 3 ], + "RepelRnage": [ + 15 + ], "BulletDeviationAngleRange": [ 0 ], @@ -1108,8 +1184,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0007", "__BeginReloadSound": "reloadBegin0006", @@ -1164,6 +1242,7 @@ "ScatteringRangeAddValue": 3, "ScatteringRangeBackSpeed": 50, "ScatteringRangeBackDelayTime": 0.3, + "CameraShake": 2, "BacklashRange": [ 1, 2 @@ -1173,9 +1252,12 @@ "DefaultAngle": 0, "UpliftAngleRestore": 1, "BulletId": "bullet0003", - "BulletHarmRange": [ + "HarmRange": [ 3 ], + "RepelRnage": [ + 15 + ], "BulletDeviationAngleRange": [ 0 ], @@ -1195,8 +1277,10 @@ }, "CanMeleeAttack": true, "MeleeAttackHarmRange": [ - 5, - 8 + 10 + ], + "MeleeAttackRepelRnage": [ + 100 ], "__ShootSound": "shooting0007", "__BeginReloadSound": "reloadBegin0006", diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json index 1c55d41..74763d2 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preinstall.json @@ -1 +1 @@ -[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":19,"Y":2},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":10,"Y":22},"Size":{"X":0,"Y":0},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]}],[{"Position":{"X":11,"Y":38},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-15,"Y":31},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0.5,"MarkList":[{"Id":"prop5000","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":36,"Y":36},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":35,"Y":2},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1.5,"MarkList":[{"Id":"prop0002","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-12,"Y":3},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":2,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-36,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5000","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":-24},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":19,"Y":2},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":10,"Y":22},"Size":{"X":0,"Y":0},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":0,"Y":16},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0002","Weight":100,"Attr":{"CurrAmmon":"7","ResidueAmmo":"70"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":23,"Y":-24},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0004","Weight":100,"Attr":{"CurrAmmon":"180","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-35,"Y":59},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0005","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"40"},"Altitude":8,"VerticalSpeed":0}]}],[{"Position":{"X":11,"Y":38},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0003","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-15,"Y":31},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0.5,"MarkList":[{"Id":"prop5000","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":36,"Y":36},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":35,"Y":2},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1.5,"MarkList":[{"Id":"prop0002","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-12,"Y":3},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":2,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-36,"Y":-18},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5000","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":56,"Y":-24},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop5001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/sprite/effects/weapon/MeleeAttack1.png b/DungeonShooting_Godot/resource/sprite/effects/weapon/MeleeAttack1.png index c22890a..aaa2799 100644 --- a/DungeonShooting_Godot/resource/sprite/effects/weapon/MeleeAttack1.png +++ b/DungeonShooting_Godot/resource/sprite/effects/weapon/MeleeAttack1.png Binary files differ diff --git a/DungeonShooting_Godot/resource/spriteFrames/effect/KnifeHit1.tres b/DungeonShooting_Godot/resource/spriteFrames/effect/KnifeHit1.tres index e519ec9..69b6d5a 100644 --- a/DungeonShooting_Godot/resource/spriteFrames/effect/KnifeHit1.tres +++ b/DungeonShooting_Godot/resource/spriteFrames/effect/KnifeHit1.tres @@ -47,7 +47,7 @@ "duration": 1.0, "texture": SubResource("6") }], -"loop": true, +"loop": false, "name": &"default", "speed": 30.0 }] diff --git a/DungeonShooting_Godot/scene/test/TestCreateSector.tscn b/DungeonShooting_Godot/scene/test/TestCreateSector.tscn new file mode 100644 index 0000000..795fc2e --- /dev/null +++ b/DungeonShooting_Godot/scene/test/TestCreateSector.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://d4axmwaqk1f55"] + +[ext_resource type="Script" path="res://src/test/TestCreateSector.cs" id="1_ieqp4"] +[ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="2_73jok"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_42m3w"] + +[node name="TestCreateSector" type="Node2D"] +script = ExtResource("1_ieqp4") + +[node name="Area2D" type="Area2D" parent="."] +position = Vector2(959, 505) + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Area2D"] + +[node name="Sprite2D" type="Sprite2D" parent="Area2D/CollisionPolygon2D"] +texture = ExtResource("2_73jok") + +[node name="Area2D2" type="Area2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D2"] +shape = SubResource("CircleShape2D_42m3w") diff --git a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs index 8f2f8ec..2496449 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig_Weapon.cs @@ -131,7 +131,7 @@ public float BeLoadedTime; /// - /// 连续发射次数范围, 仅当 'ContinuousShoot' 为 false 时生效
+ /// 连续发射次数区间, 仅当 'ContinuousShoot' 为 false 时生效
/// 格式为[value]或者[min,max] ///
[JsonInclude] @@ -168,7 +168,7 @@ public float FiringSpeedBackSpeed; /// - /// 单次开火发射子弹数量范围
+ /// 单次开火发射子弹数量区间
/// 格式为[value]或者[min,max] ///
[JsonInclude] @@ -211,7 +211,13 @@ public float ScatteringRangeBackDelayTime; /// - /// 后坐力范围 (仅用于开火后武器身抖动)
+ /// 开火后相机抖动强度,只有玩家拾起武器开火才会抖动相机 + ///
+ [JsonInclude] + public float CameraShake; + + /// + /// 后坐力区间 (仅用于开火后武器身抖动)
/// 格式为[value]或者[min,max] ///
[JsonInclude] @@ -248,14 +254,22 @@ public string BulletId; /// - /// 子弹造成的伤害范围
+ /// 造成的伤害区间
/// 格式为[value]或者[min,max] ///
[JsonInclude] - public int[] BulletHarmRange; + public int[] HarmRange; /// - /// 子弹偏移角度范围
+ /// 造成伤害后击退值区间
+ /// 如果发射子弹,则按每发子弹算击退
+ /// 格式为[value]或者[min,max] + ///
+ [JsonInclude] + public float[] RepelRnage; + + /// + /// 子弹偏移角度区间
/// 用于设置子弹偏移朝向, 该属性和射半径效果类似, 但与其不同的是, 散射半径是用来控制枪口朝向的, 而该属性是控制子弹朝向的, 可用于制作霰弹枪子弹效果
/// 格式为[value]或者[min,max] ///
@@ -263,14 +277,14 @@ public float[] BulletDeviationAngleRange; /// - /// 子弹初速度范围
+ /// 子弹初速度区间
/// 格式为[value]或者[min,max] ///
[JsonInclude] public float[] BulletSpeedRange; /// - /// 子弹飞行距离范围
+ /// 子弹飞行距离区间
/// 格式为[value]或者[min,max] ///
[JsonInclude] @@ -302,13 +316,20 @@ public bool CanMeleeAttack; /// - /// 近战攻击伤害范围
+ /// 近战攻击伤害区间
/// 格式为格式为[value]或者[min,max] ///
[JsonInclude] public int[] MeleeAttackHarmRange; /// + /// 近战攻击造成伤害后击退值区间
+ /// 格式为[value]或者[min,max] + ///
+ [JsonInclude] + public float[] MeleeAttackRepelRnage; + + /// /// 射击音效 /// public Sound ShootSound; @@ -430,13 +451,15 @@ inst.ScatteringRangeAddValue = ScatteringRangeAddValue; inst.ScatteringRangeBackSpeed = ScatteringRangeBackSpeed; inst.ScatteringRangeBackDelayTime = ScatteringRangeBackDelayTime; + inst.CameraShake = CameraShake; inst.BacklashRange = BacklashRange; inst.BacklashRegressionSpeed = BacklashRegressionSpeed; inst.UpliftAngle = UpliftAngle; inst.DefaultAngle = DefaultAngle; inst.UpliftAngleRestore = UpliftAngleRestore; inst.BulletId = BulletId; - inst.BulletHarmRange = BulletHarmRange; + inst.HarmRange = HarmRange; + inst.RepelRnage = RepelRnage; inst.BulletDeviationAngleRange = BulletDeviationAngleRange; inst.BulletSpeedRange = BulletSpeedRange; inst.BulletDistanceRange = BulletDistanceRange; @@ -445,6 +468,7 @@ inst.ThrowCollisionSize = ThrowCollisionSize; inst.CanMeleeAttack = CanMeleeAttack; inst.MeleeAttackHarmRange = MeleeAttackHarmRange; + inst.MeleeAttackRepelRnage = MeleeAttackRepelRnage; inst.ShootSound = ShootSound; inst.BeginReloadSound = BeginReloadSound; inst.BeginReloadSoundDelayTime = BeginReloadSoundDelayTime; diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index fd0bd6d..764238a 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -709,7 +709,7 @@ MoveController.RemoveForce(_throwForce); } - _throwForce = new ExternalForce("throw"); + _throwForce = new ExternalForce(ForceNames.Throw); _throwForce.Velocity = velocity; MoveController.AddForce(_throwForce); diff --git a/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs b/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs index 25a62a3..5f45e1b 100644 --- a/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs +++ b/DungeonShooting_Godot/src/framework/activity/ExternalForce.cs @@ -17,26 +17,36 @@ public bool Enable { get; set; } = true; /// - /// 阻力大小, 也就是速度每秒衰减的量 - /// - public float Resistance { get; set; } = 0; - - /// /// 是否在空中也会受到阻力 /// public bool EnableResistanceInTheAir { get; set; } = true; /// - /// 当速度到达 0 后是否自动销毁, 默认 true + /// 当速度(Velocity和RotationSpeed)到达 0 后是否自动销毁, 默认 true /// public bool AutoDestroy { get; set; } = true; /// + /// 速率的阻力大小, 也就是速度每秒衰减的量 + /// + public float VelocityResistance { get; set; } + + /// /// 当前力的速率 /// public Vector2 Velocity { get; set; } = Vector2.Zero; /// + /// 当前力对物体造成的旋转速度, 弧度制 + /// + public float RotationSpeed { get; set; } + + /// + /// 旋转速率阻力大小, 也就是速度每秒衰减的量 + /// + public float RotationResistance { get; set; } + + /// /// 物理帧更新 /// public virtual void PhysicsProcess(float delta) diff --git a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs index 67dff7f..cff7286 100644 --- a/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs +++ b/DungeonShooting_Godot/src/framework/activity/components/MoveController.cs @@ -104,8 +104,9 @@ public ExternalForce AddForce(Vector2 velocity, float resistance) { var force = AddForce("_anonymity_" + _index++); + force.AutoDestroy = true; force.Velocity = velocity; - force.Resistance = resistance; + force.VelocityResistance = resistance; return force; } @@ -224,7 +225,7 @@ { force.PhysicsProcess(delta); //自动销毁 - if (force.AutoDestroy && force.Velocity == Vector2.Zero) + if (CheckAutoDestroy(force)) { _forceList.Remove(force); externalForces[i] = null; @@ -234,15 +235,35 @@ //外力总和 var finallyEf = new Vector2(); + //旋转速率总和 + var rotationSpeed = 0f; foreach (var force in externalForces) { if (force != null && force.Enable) + { finallyEf += force.Velocity; + rotationSpeed += force.RotationSpeed; + } + } + + //处理旋转 + if (rotationSpeed != 0) + { + ActivityInstance.Rotation += rotationSpeed * delta; + } + //衰减旋转速率 + for (var i = 0; i < _forceList.Count; i++) + { + var force = _forceList[i]; + if (force.RotationResistance != 0 && (force.EnableResistanceInTheAir || !ActivityInstance.IsThrowing)) + { + force.RotationSpeed = Mathf.MoveToward(force.RotationSpeed, 0, force.RotationResistance * delta); + } } //最终速率 var finallyVelocity = _basisVelocity + finallyEf; - + //处理移动 if (finallyVelocity != Vector2.Zero) { //计算移动 @@ -289,15 +310,9 @@ ); //力速度衰减 - if (force.Resistance != 0 && (force.EnableResistanceInTheAir || !ActivityInstance.IsThrowing)) + if (force.VelocityResistance != 0 && (force.EnableResistanceInTheAir || !ActivityInstance.IsThrowing)) { - force.Velocity = force.Velocity.MoveToward(Vector2.Zero, force.Resistance * delta); - } - - //自动销毁 - if (force.AutoDestroy && force.Velocity == Vector2.Zero) - { - _forceList.RemoveAt(i--); + force.Velocity = force.Velocity.MoveToward(Vector2.Zero, force.VelocityResistance * delta); } } } @@ -309,6 +324,12 @@ } } + //检测是否达到自动销毁的条件 + private bool CheckAutoDestroy(ExternalForce force) + { + return force.AutoDestroy && force.Velocity == Vector2.Zero && force.RotationSpeed == 0; + } + public override void DebugDraw() { //绘制力大小和方向 diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs index 762dad8..b6c9f4d 100644 --- a/DungeonShooting_Godot/src/framework/common/Utils.cs +++ b/DungeonShooting_Godot/src/framework/common/Utils.cs @@ -211,4 +211,43 @@ return range[0]; } + + /// + /// 创建扇形多边形区域数据, 返回坐标点 + /// + /// 中心角度, 角度制 + /// 扇形半径 + /// 扇形开口角度, 角度制 + /// 扇形弧度边的数量 + /// 整体偏移坐标, 默认0 + public static Vector2[] CreateSectorPolygon(float centerAngle, float radius, float range, uint edgesCount, Vector2? offset = null) + { + var point = new Vector2[edgesCount + 2]; + var edgesAngle = range / edgesCount; + var startAngle = centerAngle - range * 0.5f; + var temp = new Vector2(radius, 0); + + for (var i = 0; i <= edgesCount; i++) + { + if (offset == null) + { + point[i] = temp.Rotated(Mathf.DegToRad(startAngle + edgesAngle * i)); + } + else + { + point[i] = temp.Rotated(Mathf.DegToRad(startAngle + edgesAngle * i)) + offset.Value; + } + } + + if (offset == null) + { + point[point.Length - 1] = Vector2.Zero; + } + else + { + point[point.Length - 1] = offset.Value; + } + + return point; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/ForceNames.cs b/DungeonShooting_Godot/src/game/activity/ForceNames.cs new file mode 100644 index 0000000..ae60220 --- /dev/null +++ b/DungeonShooting_Godot/src/game/activity/ForceNames.cs @@ -0,0 +1,11 @@ + +/// +/// 特殊外力名称 +/// +public class ForceNames +{ + /// + /// 投抛外力 + /// + public const string Throw = "throw"; +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs index e3f87cd..e14b273 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs @@ -14,6 +14,15 @@ public Area2D CollisionArea { get; set; } /// + /// 攻击的层级 + /// + public uint AttackLayer + { + get => CollisionArea.CollisionMask; + set => CollisionArea.CollisionMask = value; + } + + /// /// 发射该子弹的武器 /// public Weapon Weapon { get; private set; } @@ -32,6 +41,11 @@ /// 最大伤害 /// public int MaxHarm { get; set; } = 4; + + /// + /// 发射该子弹的角色 + /// + public Role Trigger { get; private set; } // 最大飞行距离 private float MaxDistance; @@ -54,13 +68,13 @@ /// 攻击目标层级 public void Init(Role trigger, Weapon weapon, float speed, float maxDistance, Vector2 position, float rotation, uint targetLayer) { + Trigger = trigger; Weapon = weapon; Role = weapon.Master; - CollisionArea.CollisionMask = targetLayer; + AttackLayer = targetLayer; CollisionArea.AreaEntered += OnArea2dEntered; - //只有玩家使用该武器才能获得正常速度的子弹 - if (trigger != null && !trigger.IsAi) + if (trigger != null && !trigger.IsAi) //只有玩家使用该武器才能获得正常速度的子弹 { FlySpeed = speed; } @@ -92,6 +106,17 @@ } } + /// + /// 播放子弹消失的特效 + /// + public virtual void PlayDisappearEffect() + { + var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_weapon_BulletDisappear_tscn); + var node = packedScene.Instantiate(); + node.GlobalPosition = GlobalPosition; + node.AddToActivityRoot(RoomLayerEnum.YSortLayer); + } + protected override void PhysicsProcessOver(float delta) { //移动 @@ -113,15 +138,11 @@ CurrFlyDistance += FlySpeed * delta; if (CurrFlyDistance >= MaxDistance) { - var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_weapon_BulletDisappear_tscn); - var node = packedScene.Instantiate(); - node.GlobalPosition = GlobalPosition; - node.AddToActivityRoot(RoomLayerEnum.YSortLayer); - + PlayDisappearEffect(); Destroy(); } } - + private void OnArea2dEntered(Area2D other) { var role = other.AsActivityObject(); @@ -136,10 +157,18 @@ var damage = Utils.Random.RandomRangeInt(MinHarm, MaxHarm); if (Role != null) { - var d = damage; damage = Role.RoleState.CallCalcDamageEvent(damage); } + + //击退 + if (role is not Player) //目标不是玩家才会触发击退 + { + var attr = Trigger != null && !Trigger.IsAi ? Weapon.PlayerUseAttribute : Weapon.AiUseAttribute; + var repel = Utils.Random.RandomConfigRange(attr.RepelRnage); + role.MoveController.AddForce(Vector2.FromAngle(BasisVelocity.Angle()) * repel, repel * 2); + } + //造成伤害 role.CallDeferred(nameof(Role.Hurt), damage, Rotation); Destroy(); } diff --git a/DungeonShooting_Godot/src/game/activity/package/Package.cs b/DungeonShooting_Godot/src/game/activity/package/Package.cs index 98b5582..ca1ad16 100644 --- a/DungeonShooting_Godot/src/game/activity/package/Package.cs +++ b/DungeonShooting_Godot/src/game/activity/package/Package.cs @@ -6,6 +6,11 @@ /// public class Package : IDestroy where T : ActivityObject, IPackageItem { + /// + /// 当前使用对象改变时回调 + /// + public event Action ChangeActiveItemEvent; + public bool IsDestroyed { get; private set; } /// @@ -16,7 +21,23 @@ /// /// 当前使用的物体对象 /// - public T ActiveItem { get; private set; } + public T ActiveItem + { + get => _activeItem; + set + { + if (value != _activeItem) + { + _activeItem = value; + if (ChangeActiveItemEvent != null) + { + ChangeActiveItemEvent(value); + } + } + } + } + + private T _activeItem; /// /// 当前使用的物体的索引 diff --git a/DungeonShooting_Godot/src/game/activity/role/Role.cs b/DungeonShooting_Godot/src/game/activity/role/Role.cs index e66a0d7..6010427 100644 --- a/DungeonShooting_Godot/src/game/activity/role/Role.cs +++ b/DungeonShooting_Godot/src/game/activity/role/Role.cs @@ -40,7 +40,7 @@ public CampEnum Camp; /// - /// 攻击目标的碰撞器所属层级, 数据源自于: PhysicsLayer + /// 攻击目标的碰撞器所属层级, 数据源自于: /// public uint AttackLayer { get; set; } = PhysicsLayer.Wall; @@ -81,6 +81,24 @@ /// [Export, ExportFillNode] public CollisionShape2D InteractiveCollision { get; set; } + + /// + /// 近战碰撞检测区域 + /// + [Export, ExportFillNode] + public Area2D MeleeAttackArea { get; set; } + + /// + /// 近战碰撞检测区域的碰撞器 + /// + [Export, ExportFillNode] + public CollisionPolygon2D MeleeAttackCollision { get; set; } + + /// + /// 近战攻击时挥动武器的角度 + /// + [Export] + public float MeleeAttackAngle { get; set; } = 120; /// /// 武器挂载点是否始终指向目标 @@ -398,6 +416,12 @@ //连接互动物体信号 InteractiveArea.BodyEntered += _OnPropsEnter; InteractiveArea.BodyExited += _OnPropsExit; + + MeleeAttackCollision.Disabled = true; + //切换武器回调 + WeaponPack.ChangeActiveItemEvent += OnChangeActiveItem; + //近战区域进入物体 + MeleeAttackArea.BodyEntered += OnMeleeAttackBodyEntered; } protected override void Process(float delta) @@ -1079,6 +1103,66 @@ } } + /// + /// 切换当前使用的武器的回调 + /// + private void OnChangeActiveItem(Weapon weapon) + { + //这里处理近战区域 + if (weapon != null) + { + MeleeAttackCollision.Polygon = Utils.CreateSectorPolygon( + Utils.ConvertAngle(-MeleeAttackAngle / 2f), + (weapon.GetLocalFirePosition() - weapon.GripPoint.Position).Length() * 1.2f, + MeleeAttackAngle, + 6 + ); + MeleeAttackArea.CollisionMask = AttackLayer | PhysicsLayer.Bullet; + } + } + + /// + /// 近战区域碰到敌人 + /// + private void OnMeleeAttackBodyEntered(Node2D body) + { + var activeWeapon = WeaponPack.ActiveItem; + if (activeWeapon == null) + { + return; + } + var activityObject = body.AsActivityObject(); + if (activityObject != null) + { + if (activityObject is Role role) //攻击角色 + { + var damage = Utils.Random.RandomConfigRange(activeWeapon.Attribute.MeleeAttackHarmRange); + damage = RoleState.CallCalcDamageEvent(damage); + + //击退 + if (role is not Player) //目标不是玩家才会触发击退 + { + var attr = IsAi ? activeWeapon.AiUseAttribute : activeWeapon.PlayerUseAttribute; + var repel = Utils.Random.RandomConfigRange(attr.MeleeAttackRepelRnage); + var position = role.GlobalPosition - MountPoint.GlobalPosition; + var v2 = position.Normalized() * repel; + role.MoveController.AddForce(v2, repel * 2); + } + + role.CallDeferred(nameof(Hurt), damage, (role.GetCenterPosition() - GlobalPosition).Angle()); + } + else if (activityObject is Bullet bullet) //攻击子弹 + { + var attackLayer = bullet.AttackLayer; + if (CollisionWithMask(attackLayer)) //是攻击玩家的子弹 + { + bullet.PlayDisappearEffect(); + bullet.Destroy(); + } + } + } + } + protected override void OnDestroy() { //销毁道具 diff --git a/DungeonShooting_Godot/src/game/activity/role/RoleState.cs b/DungeonShooting_Godot/src/game/activity/role/RoleState.cs index d195c75..c2c629b 100644 --- a/DungeonShooting_Godot/src/game/activity/role/RoleState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/RoleState.cs @@ -87,7 +87,6 @@ /// 武器初始散射值增量 /// public event Action> CalcStartScatteringEvent; - public float CallCalcStartScatteringEvent(Weapon weapon, float value) { if (CalcStartScatteringEvent != null) diff --git a/DungeonShooting_Godot/src/game/activity/role/Role_Animation.cs b/DungeonShooting_Godot/src/game/activity/role/Role_Animation.cs index 3a09f55..8de62e5 100644 --- a/DungeonShooting_Godot/src/game/activity/role/Role_Animation.cs +++ b/DungeonShooting_Godot/src/game/activity/role/Role_Animation.cs @@ -13,20 +13,20 @@ var r = MountPoint.RotationDegrees; //var gp = MountPoint.GlobalPosition; var p1 = MountPoint.Position; - var p2 = p1 + new Vector2(6, 0).Rotated(Mathf.DegToRad(r - 60)); - var p3 = p1 + new Vector2(6, 0).Rotated(Mathf.DegToRad(r + 60)); + var p2 = p1 + new Vector2(6, 0).Rotated(Mathf.DegToRad(r - MeleeAttackAngle / 2f)); + var p3 = p1 + new Vector2(6, 0).Rotated(Mathf.DegToRad(r + MeleeAttackAngle / 2f)); var tween = CreateTween(); tween.SetParallel(); - tween.TweenProperty(MountPoint, "rotation_degrees", r - 60, 0.12); - tween.TweenProperty(MountPoint, "position", p2, 0.12); - tween.TweenProperty(MountPoint, "position", p2, 0.12); + tween.TweenProperty(MountPoint, "rotation_degrees", r - MeleeAttackAngle / 2f, 0.1); + tween.TweenProperty(MountPoint, "position", p2, 0.1); + tween.TweenProperty(MountPoint, "position", p2, 0.1); tween.Chain(); tween.TweenCallback(Callable.From(() => { - MountPoint.RotationDegrees = r + 60; + MountPoint.RotationDegrees = r + MeleeAttackAngle / 2f; MountPoint.Position = p3; //重新计算武器阴影位置 var activeItem = WeaponPack.ActiveItem; @@ -44,14 +44,25 @@ } //播放特效 var sprite = ResourceManager.LoadAndInstantiate(ResourcePath.prefab_effect_weapon_MeleeAttack1_tscn); - var localFirePosition = activeItem.GetLocalFirePosition(); - localFirePosition.X *= 0.85f; + var localFirePosition = activeItem.GetLocalFirePosition() - activeItem.GripPoint.Position; + localFirePosition *= 0.9f; sprite.Position = p1 + localFirePosition.Rotated(Mathf.DegToRad(r)); sprite.RotationDegrees = r; AddChild(sprite); + + //启用近战碰撞区域 + MeleeAttackCollision.Disabled = false; })); tween.Chain(); + tween.TweenInterval(0.1f); + tween.Chain(); + + tween.TweenCallback(Callable.From(() => + { + //关闭近战碰撞区域 + MeleeAttackCollision.Disabled = true; + })); tween.TweenProperty(MountPoint, "rotation_degrees", r, 0.2); tween.TweenProperty(MountPoint, "position", p1, 0.2); tween.Chain(); diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index ace9948..34ca189 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -17,6 +17,11 @@ /// Ai使用该武器的属性 /// public ExcelConfig.Weapon AiUseAttribute => _aiWeaponAttribute; + + /// + /// 玩家使用该武器的属性 + /// + public ExcelConfig.Weapon PlayerUseAttribute => _playerWeaponAttribute; private ExcelConfig.Weapon _weaponAttribute; private ExcelConfig.Weapon _playerWeaponAttribute; @@ -135,6 +140,11 @@ /// public bool IsAutoPlaySpriteFrames { get; set; } = true; + /// + /// 在没有所属 Master 的时候是否可以触发扳机 + /// + public bool NoMasterCanTrigger { get; set; } = true; + //-------------------------------------------------------------------------------------------- //触发按下扳机的角色 @@ -663,6 +673,9 @@ /// 按下扳机的角色, 如果传 null, 则视为走火 public void Trigger(Role trigger) { + //不能触发扳机 + if (!NoMasterCanTrigger && Master == null) return; + //这一帧已经按过了, 不需要再按下 if (_triggerFlag) return; @@ -962,7 +975,7 @@ tempAngle -= Attribute.UpliftAngle; _fireAngle = tempAngle; - if (Master != null) //是否被拾起 + if (Master != null) //被拾起 { //武器身位置 var max = Mathf.Abs(Mathf.Max(Utils.GetConfigRangeStart(Attribute.BacklashRange), Utils.GetConfigRangeEnd(Attribute.BacklashRange))); @@ -973,9 +986,12 @@ Position = new Vector2(_currBacklashLength, 0).Rotated(Rotation); RotationDegrees = tempAngle; } - else + else //在地上 { - + var v = Utils.Random.RandomConfigRange(Attribute.BacklashRange) * 5; + var externalForce = MoveController.AddForce(new Vector2(-v, 0).Rotated(Rotation), v * 2); + externalForce.RotationSpeed = -Mathf.DegToRad(40); + externalForce.RotationResistance = Mathf.DegToRad(80); } } @@ -1806,8 +1822,7 @@ { var speed = Utils.Random.RandomConfigRange(Attribute.BulletSpeedRange); var distance = Utils.Random.RandomConfigRange(Attribute.BulletDistanceRange); - var deviationAngle = - Utils.Random.RandomConfigRange(Attribute.BulletDeviationAngleRange); + var deviationAngle = Utils.Random.RandomConfigRange(Attribute.BulletDeviationAngleRange); if (Master != null) { speed = Master.RoleState.CallCalcBulletSpeedEvent(this, speed); @@ -1827,8 +1842,8 @@ fireRotation + Mathf.DegToRad(deviationAngle), attackLayer ); - bullet.MinHarm = Utils.GetConfigRangeStart(Attribute.BulletHarmRange); - bullet.MaxHarm = Utils.GetConfigRangeEnd(Attribute.BulletHarmRange); + bullet.MinHarm = Utils.GetConfigRangeStart(Attribute.HarmRange); + bullet.MaxHarm = Utils.GetConfigRangeEnd(Attribute.HarmRange); bullet.PutDown(RoomLayerEnum.YSortLayer); return bullet; } diff --git a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs index 0dfeaeb..b8e288f 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/gun/Gun.cs @@ -11,7 +11,7 @@ if (Master == Player.Current) { //创建抖动 - GameCamera.Main.DirectionalShake(Vector2.Right.Rotated(GlobalRotation) * 2f); + GameCamera.Main.DirectionalShake(Vector2.Right.Rotated(GlobalRotation) * Attribute.CameraShake); } //创建开火特效 diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs index e9651c8..0f83144 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs @@ -1,21 +1,45 @@ using Godot; +/// +/// 近战武器,刀 +/// [Tool] public partial class Knife : Weapon { + /// + /// 近战攻击范围 + /// + [Export] + public int AttackRange { get; set; } = 41; + + /// + /// 开始蓄力时武器抬起角度 + /// + [Export] + public int BeginChargeAngle { get; set; } = 120; private Area2D _hitArea; private int _attackIndex = 0; + private CollisionPolygon2D _collisionPolygon; public override void OnInit() { base.OnInit(); - + + //没有Master时不能触发开火 + NoMasterCanTrigger = false; _hitArea = GetNode("HitArea"); + _collisionPolygon = new CollisionPolygon2D(); + var a = Mathf.Abs(-BeginChargeAngle + Attribute.UpliftAngle); + var ca = Utils.ConvertAngle(-a / 2f); + _collisionPolygon.Polygon = Utils.CreateSectorPolygon(ca, AttackRange, a, 6); + _hitArea.AddChild(_collisionPolygon); + _hitArea.Monitoring = false; _hitArea.Monitorable = false; _hitArea.BodyEntered += OnBodyEntered; + //禁用自动播放动画 IsAutoPlaySpriteFrames = false; } @@ -42,15 +66,15 @@ protected override void OnBeginCharge() { - //开始蓄力时武器角度上抬120度 - RotationDegrees = -120; + //开始蓄力时武器角度 + RotationDegrees = -BeginChargeAngle; } protected override void OnFire() { GD.Print("近战武器攻击! 蓄力时长: " + GetTriggerChargeTime() + ", 扳机按下时长: " + GetTriggerDownTime()); //更新碰撞层级 - _hitArea.CollisionMask = GetAttackLayer(); + _hitArea.CollisionMask = GetAttackLayer() | PhysicsLayer.Bullet; //启用碰撞 _hitArea.Monitoring = true; _attackIndex = 0; @@ -59,8 +83,11 @@ { //播放挥刀特效 SpecialEffectManager.Play( + Master, ResourcePath.resource_spriteFrames_effect_KnifeHit1_tres, "default", - Master.MountPoint.GlobalPosition, GlobalRotation + Mathf.Pi * 0.5f, new Vector2((int)Master.Face, 1) * AnimatedSprite.Scale, + Master.MountPoint.Position, + Master.MountPoint.Rotation + Mathf.DegToRad(Attribute.UpliftAngle + 60), + AnimatedSprite.Scale, new Vector2(17, 4), 1 ); } @@ -68,8 +95,18 @@ if (Master == Player.Current) { - //创建抖动 - //GameCamera.Main.ProcessDirectionalShake(Vector2.Right.Rotated(GlobalRotation - Mathf.Pi * 0.5f) * 1.5f); + var r = Master.MountPoint.RotationDegrees; + //创建屏幕抖动 + if (Master.Face == FaceDirection.Right) + { + //GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(r - 90)) * 5); + GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(r - 180)) * Attribute.CameraShake); + } + else + { + //GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(270 - r)) * 5); + GameCamera.Main.DirectionalShake(Vector2.FromAngle(Mathf.DegToRad(-r)) * Attribute.CameraShake); + } } } @@ -86,14 +123,37 @@ private void OnBodyEntered(Node2D body) { - GD.Print("碰到物体: " + body.Name); + //GD.Print("碰到物体: " + body.Name); var activityObject = body.AsActivityObject(); if (activityObject != null) { - if (activityObject is Role role) + if (activityObject is Role role) //碰到角色 { - role.CallDeferred(nameof(Role.Hurt), - Utils.Random.RandomConfigRange(Attribute.BulletHarmRange), (role.GetCenterPosition() - GlobalPosition).Angle()); + var damage = Utils.Random.RandomConfigRange(Attribute.HarmRange); + damage = Master.RoleState.CallCalcDamageEvent(damage); + //击退 + if (role is not Player) //目标不是玩家才会触发击退 + { + var attr = Master.IsAi ? AiUseAttribute : PlayerUseAttribute; + var repel = Utils.Random.RandomConfigRange(attr.RepelRnage); + var position = role.GlobalPosition - Master.MountPoint.GlobalPosition; + var v2 = position.Normalized() * repel; + role.MoveController.AddForce(v2, repel * 2); + } + + //造成伤害 + role.CallDeferred(nameof(Role.Hurt), damage, (role.GetCenterPosition() - GlobalPosition).Angle()); + } + else if (activityObject is Bullet bullet) //攻击子弹 + { + var attackLayer = bullet.AttackLayer; + if (Master.CollisionWithMask(attackLayer)) //是攻击玩家的子弹 + { + bullet.PlayDisappearEffect(); + bullet.BasisVelocity = bullet.BasisVelocity.Rotated(Mathf.Pi); + bullet.Rotation += Mathf.Pi; + bullet.AttackLayer = Master.AttackLayer; + } } } } diff --git a/DungeonShooting_Godot/src/game/effects/AutoDestroySprite.cs b/DungeonShooting_Godot/src/game/effects/AutoDestroySprite.cs index 857819d..a24db0c 100644 --- a/DungeonShooting_Godot/src/game/effects/AutoDestroySprite.cs +++ b/DungeonShooting_Godot/src/game/effects/AutoDestroySprite.cs @@ -1,4 +1,5 @@ using Godot; +using Godot.Collections; /// /// 到期自动销毁的帧动画 @@ -11,9 +12,22 @@ [Export] public float DelayTime { get; set; } = 1f; + /// + /// 子节点包含的例子特效, 在创建完成后自动播放 + /// + [Export] + public Array Particles2D { get; set; } + public override async void _Ready() { var sceneTreeTimer = GetTree().CreateTimer(DelayTime); + if (Particles2D != null) + { + foreach (var gpuParticles2D in Particles2D) + { + gpuParticles2D.Emitting = true; + } + } await ToSignal(sceneTreeTimer, Timer.SignalName.Timeout); QueueFree(); } diff --git a/DungeonShooting_Godot/src/game/manager/SpecialEffectManager.cs b/DungeonShooting_Godot/src/game/manager/SpecialEffectManager.cs index c5e59bb..0d74206 100644 --- a/DungeonShooting_Godot/src/game/manager/SpecialEffectManager.cs +++ b/DungeonShooting_Godot/src/game/manager/SpecialEffectManager.cs @@ -41,6 +41,7 @@ /// /// 在场景指定位置播放一个特效, 特效必须是 SpriteFrames 类型 /// + /// 挂载的根节点 /// 特效SpriteFrames资源路径 /// 动画名称 /// 坐标 @@ -50,11 +51,11 @@ /// 层级 /// 播放速度 /// 循环次数, 到达该次数特效停止播放 - public static void Play(string path, string animName, Vector2 pos, float rotation, Vector2 scale, Vector2 offset, int zIndex = 0, float speed = 1, int loopCount = 1) + public static void Play(Node root, string path, string animName, Vector2 pos, float rotation, Vector2 scale, Vector2 offset, int zIndex = 0, float speed = 1, int loopCount = 1) { var spriteFrames = ResourceManager.Load(path); var specialEffect = new SpecialEffect(); - specialEffect.GlobalPosition = pos; + specialEffect.Position = pos; specialEffect.Rotation = rotation; specialEffect.Scale = scale; specialEffect.ZIndex = zIndex; @@ -63,6 +64,6 @@ specialEffect.LoopCount = loopCount; specialEffect.SpriteFrames = spriteFrames; specialEffect.Play(animName); - specialEffect.AddToActivityRoot(RoomLayerEnum.YSortLayer); + root.AddChild(specialEffect); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/test/TestCreateSector.cs b/DungeonShooting_Godot/src/test/TestCreateSector.cs new file mode 100644 index 0000000..72b6418 --- /dev/null +++ b/DungeonShooting_Godot/src/test/TestCreateSector.cs @@ -0,0 +1,24 @@ +using Godot; +using System; + +public partial class TestCreateSector : Node2D +{ + + private CollisionPolygon2D _polygon2D; + + public override void _Ready() + { + GetNode("Area2D").AreaEntered += area => + { + GD.Print("areaEnter: " + area.Name); + }; + + _polygon2D = GetNode("Area2D/CollisionPolygon2D"); + _polygon2D.Polygon = Utils.CreateSectorPolygon(90, 350, 160, 10); + } + + public override void _Process(double delta) + { + GetNode("Area2D2").GlobalPosition = GetGlobalMousePosition(); + } +}