diff --git a/DungeonShooting_Godot/prefab/role/Enemy.tscn b/DungeonShooting_Godot/prefab/role/Enemy.tscn index 420c52d..c3af846 100644 --- a/DungeonShooting_Godot/prefab/role/Enemy.tscn +++ b/DungeonShooting_Godot/prefab/role/Enemy.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=19 format=3 uid="uid://dbrig6dq441wo"] -[ext_resource type="PackedScene" uid="uid://4v6441urmwrf" path="res://prefab/role/Role.tscn" id="1_qkqsa"] +[ext_resource type="PackedScene" path="res://prefab/role/Role.tscn" id="1_qkqsa"] [ext_resource type="Shader" path="res://resource/materlal/Blend.gdshader" id="2_in1s7"] [ext_resource type="Texture2D" uid="uid://un6gylhe011n" path="res://resource/sprite/role/role8.png" id="3_tk1tp"] @@ -81,7 +81,7 @@ }], "loop": true, "name": &"idle", -"speed": 5.0 +"speed": 7.0 }, { "frames": [{ "duration": 1.0, @@ -98,7 +98,7 @@ }], "loop": true, "name": &"reverseRun", -"speed": 5.0 +"speed": 10.0 }, { "frames": [{ "duration": 1.0, @@ -115,12 +115,12 @@ }], "loop": true, "name": &"run", -"speed": 5.0 +"speed": 10.0 }] [node name="Enemy" instance=ExtResource("1_qkqsa")] collision_layer = 16 -collision_mask = 1 +collision_mask = 25 [node name="ShadowSprite" parent="." index="0"] material = SubResource("ShaderMaterial_8vxx6") @@ -130,6 +130,9 @@ sprite_frames = SubResource("SpriteFrames_m7t3e") animation = &"idle" +[node name="HurtArea" parent="." index="4"] +visible = false + [node name="ViewRay" type="RayCast2D" parent="." index="6"] position = Vector2(0, -8) enabled = false @@ -138,4 +141,6 @@ position = Vector2(0, -5) [node name="NavigationAgent2D" type="NavigationAgent2D" parent="NavigationPoint" index="0"] +path_desired_distance = 3.0 +target_desired_distance = 3.0 radius = 20.0 diff --git a/DungeonShooting_Godot/prefab/role/Player.tscn b/DungeonShooting_Godot/prefab/role/Player.tscn index 04aa9bb..d3105c0 100644 --- a/DungeonShooting_Godot/prefab/role/Player.tscn +++ b/DungeonShooting_Godot/prefab/role/Player.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=19 format=3 uid="uid://cdohv4xeirtuc"] -[ext_resource type="PackedScene" uid="uid://4v6441urmwrf" path="res://prefab/role/Role.tscn" id="1"] +[ext_resource type="PackedScene" path="res://prefab/role/Role.tscn" id="1"] [ext_resource type="Shader" path="res://resource/materlal/Blend.gdshader" id="2_nvo1u"] [ext_resource type="Texture2D" uid="uid://bhwhhg2dfsr26" path="res://resource/sprite/role/role2.png" id="3_55mk2"] diff --git a/DungeonShooting_Godot/prefab/role/Role.tscn b/DungeonShooting_Godot/prefab/role/Role.tscn index 0907845..d3508ef 100644 --- a/DungeonShooting_Godot/prefab/role/Role.tscn +++ b/DungeonShooting_Godot/prefab/role/Role.tscn @@ -5,6 +5,7 @@ [ext_resource type="Script" path="res://src/game/role/MountRotation.cs" id="4"] + [sub_resource type="ShaderMaterial" id="ShaderMaterial_v2kfw"] resource_local_to_scene = true shader = ExtResource("2_q6jwp") diff --git a/DungeonShooting_Godot/prefab/test/TestActivity.tscn b/DungeonShooting_Godot/prefab/test/TestActivity.tscn index 193330c..475c7ad 100644 --- a/DungeonShooting_Godot/prefab/test/TestActivity.tscn +++ b/DungeonShooting_Godot/prefab/test/TestActivity.tscn @@ -5,6 +5,7 @@ [ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="3"] + [sub_resource type="ShaderMaterial" id="ShaderMaterial_rxkv3"] resource_local_to_scene = true shader = ExtResource("1") diff --git a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn index 66ca721..22ab281 100644 --- a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn +++ b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn @@ -1,22 +1,25 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=11 format=3 uid="uid://bvpmtfupny8iu"] -[ext_resource path="res://src/game/ui/RoomUI.cs" type="Script" id=1] -[ext_resource path="res://resource/sprite/ui/mapBar.png" type="Texture2D" id=2] -[ext_resource path="res://prefab/ui/bar/ReloadBar.tscn" type="PackedScene" id=3] -[ext_resource path="res://resource/sprite/ui/healthBar.png" type="Texture2D" id=4] -[ext_resource path="res://resource/sprite/gun/gun4.png" type="Texture2D" id=5] -[ext_resource path="res://resource/sprite/ui/hpBar.png" type="Texture2D" id=6] -[ext_resource path="res://resource/sprite/ui/shieldBar.png" type="Texture2D" id=7] -[ext_resource path="res://resource/sprite/ui/hpSlot.png" type="Texture2D" id=8] -[ext_resource path="res://resource/sprite/ui/shieldSlot.png" type="Texture2D" id=9] -[ext_resource path="res://prefab/ui/bar/InteractiveTipBar.tscn" type="PackedScene" id=10] +[ext_resource type="Script" path="res://src/game/ui/RoomUI.cs" id="1"] +[ext_resource type="Texture2D" uid="uid://k621mhhkg65f" path="res://resource/sprite/ui/mapBar.png" id="2"] +[ext_resource type="PackedScene" path="res://prefab/ui/bar/ReloadBar.tscn" id="3"] +[ext_resource type="Texture2D" uid="uid://u5ul7fu8wv1a" path="res://resource/sprite/ui/healthBar.png" id="4"] +[ext_resource type="Texture2D" uid="uid://xafbhgrxmosy" path="res://resource/sprite/gun/gun4.png" id="5"] +[ext_resource type="Texture2D" uid="uid://bxd75tme0v3pb" path="res://resource/sprite/ui/hpBar.png" id="6"] +[ext_resource type="Texture2D" uid="uid://h25j6uka74tv" path="res://resource/sprite/ui/shieldBar.png" id="7"] +[ext_resource type="Texture2D" uid="uid://djcdjrs07ighv" path="res://resource/sprite/ui/hpSlot.png" id="8"] +[ext_resource type="Texture2D" uid="uid://dnpguajopuyd7" path="res://resource/sprite/ui/shieldSlot.png" id="9"] +[ext_resource type="PackedScene" path="res://prefab/ui/bar/InteractiveTipBar.tscn" id="10"] [node name="RoomUI" type="Control"] +layout_mode = 3 +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -script = ExtResource( 1 ) +script = ExtResource("1") [node name="Control" type="Control" parent="."] +anchors_preset = 0 anchor_right = 1.0 anchor_bottom = 1.0 offset_left = 20.0 @@ -25,59 +28,66 @@ offset_bottom = -20.0 [node name="HealthBar" type="TextureRect" parent="Control"] -offset_right = 67.0 +layout_mode = 0 +offset_right = 14.0 offset_bottom = 14.0 -scale = Vector2( 4, 4 ) -texture = ExtResource( 4 ) +scale = Vector2(4, 4) +texture = ExtResource("4") [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( 8 ) +texture = ExtResource("8") 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( 6 ) -expand = true +texture = ExtResource("6") +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 ) +texture = ExtResource("9") 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( 7 ) -expand = true +texture = ExtResource("7") +expand_mode = 1 [node name="MapBar" type="TextureRect" parent="Control"] +layout_mode = 0 anchor_left = 1.0 anchor_right = 1.0 offset_left = -176.0 offset_right = -132.0 offset_bottom = 44.0 -scale = Vector2( 4, 4 ) -texture = ExtResource( 2 ) +scale = Vector2(4, 4) +texture = ExtResource("2") [node name="GunBar" type="Control" parent="Control"] +anchors_preset = 0 anchor_top = 1.0 anchor_bottom = 1.0 offset_top = -264.0 @@ -85,6 +95,7 @@ offset_bottom = 0.00146484 [node name="GunSprite" type="TextureRect" parent="Control/GunBar"] +layout_mode = 0 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 @@ -93,10 +104,11 @@ offset_top = -132.0 offset_right = -66.0 offset_bottom = -66.0 -scale = Vector2( 4, 4 ) -texture = ExtResource( 5 ) +scale = Vector2(4, 4) +texture = ExtResource("5") [node name="BulletText" type="Label" parent="Control/GunBar"] +layout_mode = 0 anchor_left = 0.5 anchor_right = 0.5 offset_left = -89.0 @@ -104,13 +116,14 @@ offset_right = 89.0 offset_bottom = 74.0 text = "30/90" -align = 1 +horizontal_alignment = 1 +vertical_alignment = 1 [node name="GlobalNode" type="Node" parent="."] [node name="ViewNode" type="Node" parent="."] -[node name="InteractiveTipBar" parent="ViewNode" instance=ExtResource( 10 )] +[node name="InteractiveTipBar" parent="ViewNode" instance=ExtResource("10")] -[node name="ReloadBar" parent="ViewNode" instance=ExtResource( 3 )] +[node name="ReloadBar" parent="ViewNode" instance=ExtResource("3")] z_index = 15 diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon.tscn index 579b1aa..677db9c 100644 --- a/DungeonShooting_Godot/prefab/weapon/Weapon.tscn +++ b/DungeonShooting_Godot/prefab/weapon/Weapon.tscn @@ -4,6 +4,7 @@ [ext_resource type="Script" path="res://src/framework/activity/ActivityObjectTemplate.cs" id="1_dtam7"] + [sub_resource type="ShaderMaterial" id="ShaderMaterial_cbiyh"] resource_local_to_scene = true shader = ExtResource("1") diff --git a/DungeonShooting_Godot/prefab/weapon/bullet/Bullet.tscn b/DungeonShooting_Godot/prefab/weapon/bullet/Bullet.tscn index dc48a04..8c2d043 100644 --- a/DungeonShooting_Godot/prefab/weapon/bullet/Bullet.tscn +++ b/DungeonShooting_Godot/prefab/weapon/bullet/Bullet.tscn @@ -5,6 +5,7 @@ [ext_resource type="Texture2D" uid="uid://bu0b11hiuecxy" path="res://resource/sprite/bullet/bullet.png" id="3"] + [sub_resource type="ShaderMaterial" id="ShaderMaterial_5a4f2"] resource_local_to_scene = true shader = ExtResource("2") diff --git a/DungeonShooting_Godot/prefab/weapon/shell/ShellCase.tscn b/DungeonShooting_Godot/prefab/weapon/shell/ShellCase.tscn index 4e8ca6b..5d7b253 100644 --- a/DungeonShooting_Godot/prefab/weapon/shell/ShellCase.tscn +++ b/DungeonShooting_Godot/prefab/weapon/shell/ShellCase.tscn @@ -5,6 +5,7 @@ [ext_resource type="Shader" path="res://resource/materlal/Blend.gdshader" id="2"] + [sub_resource type="ShaderMaterial" id="ShaderMaterial_px12l"] resource_local_to_scene = true shader = ExtResource("2") diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index 09eced0..c3a5d55 100644 --- a/DungeonShooting_Godot/resource/theme/mainTheme.tres +++ b/DungeonShooting_Godot/resource/theme/mainTheme.tres @@ -350,7 +350,7 @@ [sub_resource type="ImageTexture" id="58"] -[sub_resource type="Image" id="Image_etiwd"] +[sub_resource type="Image" id="Image_iyt8m"] 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", @@ -360,7 +360,7 @@ } [sub_resource type="ImageTexture" id="60"] -image = SubResource("Image_etiwd") +image = SubResource("Image_iyt8m") [sub_resource type="StyleBoxTexture" id="61"] content_margin_left = 2.0 @@ -370,7 +370,7 @@ texture = SubResource("60") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_7x64l"] +[sub_resource type="Image" id="Image_5go3g"] 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", @@ -380,7 +380,7 @@ } [sub_resource type="ImageTexture" id="63"] -image = SubResource("Image_7x64l") +image = SubResource("Image_5go3g") [sub_resource type="StyleBoxTexture" id="64"] content_margin_left = 2.0 @@ -390,7 +390,7 @@ texture = SubResource("63") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_oc86d"] +[sub_resource type="Image" id="Image_2jhqf"] 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", @@ -400,7 +400,7 @@ } [sub_resource type="ImageTexture" id="66"] -image = SubResource("Image_oc86d") +image = SubResource("Image_2jhqf") [sub_resource type="StyleBoxTexture" id="67"] content_margin_left = 2.0 @@ -410,7 +410,7 @@ texture = SubResource("66") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_jy41s"] +[sub_resource type="Image" id="Image_fyayv"] 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", @@ -420,7 +420,7 @@ } [sub_resource type="ImageTexture" id="69"] -image = SubResource("Image_jy41s") +image = SubResource("Image_fyayv") [sub_resource type="StyleBoxTexture" id="70"] content_margin_left = 0.0 @@ -444,7 +444,7 @@ content_margin_right = 4.0 content_margin_bottom = 4.0 -[sub_resource type="Image" id="Image_g5qtm"] +[sub_resource type="Image" id="Image_g2dan"] 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", @@ -454,7 +454,7 @@ } [sub_resource type="ImageTexture" id="56"] -image = SubResource("Image_g5qtm") +image = SubResource("Image_g2dan") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn index a49bbb2..b898f80 100644 --- a/DungeonShooting_Godot/scene/Main.tscn +++ b/DungeonShooting_Godot/scene/Main.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=7 format=3 uid="uid://lbe753cb8heb"] [ext_resource type="PackedScene" uid="uid://bqf2vks5ggnsp" path="res://scene/Room.tscn" id="1"] -[ext_resource type="PackedScene" path="res://prefab/ui/RoomUI.tscn" id="2"] +[ext_resource type="PackedScene" uid="uid://bvpmtfupny8iu" path="res://prefab/ui/RoomUI.tscn" id="2"] [ext_resource type="Script" path="res://src/game/GameApplication.cs" id="3"] [ext_resource type="PackedScene" path="res://prefab/ui/Cursor.tscn" id="4"] @@ -24,6 +24,7 @@ [node name="Main" type="Node2D"] script = ExtResource("3") +Debug = true CursorPack = ExtResource("4") RoomPath = NodePath("ViewCanvas/SubViewportContainer/SubViewport/Room") ViewportPath = NodePath("ViewCanvas/SubViewportContainer/SubViewport") diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index 432d6a1..46ec125 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -96,6 +96,7 @@ private Dictionary _signMap; private List> _coroutineList; + private ActivityObjectTemplate _templateInstance; private static long _coroutineId = 0; private static long _index = 0; @@ -110,19 +111,19 @@ throw new Exception("创建 ActivityObject 没有找到指定挂载的预制体: " + scenePath); } - var tempNode = tempPrefab.Instantiate(); - ZIndex = tempNode.z_index; - CollisionLayer = tempNode.collision_layer; - CollisionMask = tempNode.collision_mask; - Scale = tempNode.scale; - Visible = tempNode.visible; + _templateInstance = tempPrefab.Instantiate(); + ZIndex = _templateInstance.z_index; + CollisionLayer = _templateInstance.collision_layer; + CollisionMask = _templateInstance.collision_mask; + Scale = _templateInstance.scale; + Visible = _templateInstance.visible; //移动子节点 - var count = tempNode.GetChildCount(); + var count = _templateInstance.GetChildCount(); for (int i = 0; i < count; i++) { - var body = tempNode.GetChild(0); - tempNode.RemoveChild(body); + var body = _templateInstance.GetChild(0); + _templateInstance.RemoveChild(body); AddChild(body); switch (body.Name) { @@ -144,7 +145,7 @@ } MoveController = AddComponent(); - tempNode.QueueFree(); + //tempNode.CallDeferred(Node.MethodName.QueueFree); } /// @@ -746,6 +747,8 @@ { arr[i].Value?.Destroy(); } + //临时处理, 4.0 有bug, 不能销毁模板实例, 不然关闭游戏会报错!!! + _templateInstance.QueueFree(); } /// @@ -949,6 +952,9 @@ _playHitSchedule = 0; } + /// + /// 开启一个协程, 返回协程 id + /// public long StartCoroutine(IEnumerable able) { var id = _coroutineId++; @@ -960,6 +966,9 @@ return id; } + /// + /// 根据协程 id 停止协程 + /// public void StopCoroutine(long coroutineId) { if (_coroutineList != null) @@ -976,6 +985,9 @@ } } + /// + /// 停止所有协程 + /// public void StopAllCoroutine() { if (_coroutineList != null) diff --git a/DungeonShooting_Godot/src/game/camera/GameCamera.cs b/DungeonShooting_Godot/src/game/camera/GameCamera.cs index 9793071..066f275 100644 --- a/DungeonShooting_Godot/src/game/camera/GameCamera.cs +++ b/DungeonShooting_Godot/src/game/camera/GameCamera.cs @@ -37,23 +37,35 @@ _camPos = GlobalPosition; } - //public override void _PhysicsProcess(float delta); - public override void _Process(double delta) { var newDelta = (float)delta; _Shake(newDelta); + // 3.5 写法 + // var player = GameApplication.Instance.RoomManager.Player; + // var viewportContainer = GameApplication.Instance.SubViewportContainer; + // var camPos = player.GlobalPosition; + // _camPos = _camPos.Lerp(camPos, Mathf.Min(6 * newDelta, 1)) + _shakeOffset; + // SubPixelPosition = _camPos.Round() - _camPos; + // (viewportContainer.Material as ShaderMaterial)?.SetShaderParameter("offset", SubPixelPosition); + // GlobalPosition = _camPos.Round(); + var player = GameApplication.Instance.RoomManager.Player; - var viewportContainer = GameApplication.Instance.SubViewportContainer; - var camPos = player.GlobalPosition; - //var camPos = player.GlobalPosition.Lerp(mousePos, 0); - //_camPos = camPos + _shakeOffset; - _camPos = _camPos.Lerp(camPos, Mathf.Min(6 * newDelta, 1)) + _shakeOffset; + var mousePosition = InputManager.GetViewportMousePosition(); + var playerPosition = player.GlobalPosition; + Vector2 targetPos; + if (playerPosition.DistanceSquaredTo(mousePosition) >= (60 / 0.3f) * (60 / 0.3f)) + { + targetPos = playerPosition.MoveToward(mousePosition, 60); + } + else + { + targetPos = playerPosition.Lerp(mousePosition, 0.3f); + } + _camPos = _camPos.Lerp(targetPos, Mathf.Min(6 * newDelta, 1)) + _shakeOffset; SubPixelPosition = _camPos.Round() - _camPos; - //(viewportContainer.Material as ShaderMaterial)?.SetShaderParameter("offset", SubPixelPosition); GlobalPosition = _camPos.Round(); - //GlobalPosition = _camPos; } /// diff --git a/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs index 7d6a250..a3b5c66 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs @@ -341,8 +341,9 @@ return; } - var index2 = Holster.FindWeapon((we, i) => - we.Attribute.WeightType == weapon.Attribute.WeightType && we.IsTotalAmmoEmpty()); + // var index2 = Holster.FindWeapon((we, i) => + // we.Attribute.WeightType == weapon.Attribute.WeightType && we.IsTotalAmmoEmpty()); + var index2 = Holster.FindWeapon((we, i) => we.IsTotalAmmoEmpty()); if (index2 != -1) //扔掉没子弹的武器 { ThrowWeapon(index2); @@ -350,11 +351,11 @@ return; } - if (Holster.HasVacancy()) //有空位, 拾起武器 - { - TriggerInteractive(); - return; - } + // if (Holster.HasVacancy()) //有空位, 拾起武器 + // { + // TriggerInteractive(); + // return; + // } } } diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiFindAmmoState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiFindAmmoState.cs index 908ae71..b325bc5 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiFindAmmoState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiFindAmmoState.cs @@ -104,7 +104,7 @@ { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiFollowUpState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiFollowUpState.cs index 5342d4e..ce397e1 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiFollowUpState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiFollowUpState.cs @@ -38,6 +38,11 @@ ChangeStateLate(AiStateEnum.AiFindAmmo); return; } + else + { + //切换到随机移动状态 + ChangeStateLate(AiStateEnum.AiSurround); + } } var playerPos = Player.Current.GetCenterPosition(); @@ -72,7 +77,7 @@ { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - masterPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; } diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiLeaveForState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiLeaveForState.cs index ed9807e..1245c70 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiLeaveForState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiLeaveForState.cs @@ -59,7 +59,7 @@ //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); Master.LookTargetPosition(Enemy.FindTargetPosition); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; } diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs index 3932531..434ee38 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiNormalState.cs @@ -67,7 +67,7 @@ } else if (_pauseTimer >= 0) { - Master.AnimatedSprite.Animation = AnimatorNames.Idle; + Master.AnimatedSprite.Play(AnimatorNames.Idle); _pauseTimer -= delta; } else if (_isMoveOver) //没发现玩家, 且已经移动完成 @@ -89,7 +89,7 @@ _moveFlag = true; //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; } @@ -107,7 +107,7 @@ { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; } diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs index 755237a..ac0b98f 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiSurroundState.cs @@ -69,7 +69,7 @@ { if (_pauseTimer >= 0) { - Master.AnimatedSprite.Animation = AnimatorNames.Idle; + Master.AnimatedSprite.Play(AnimatorNames.Idle); _pauseTimer -= delta; } else if (_isMoveOver) //移动已经完成 @@ -91,7 +91,7 @@ _moveFlag = true; //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; } @@ -109,7 +109,7 @@ { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; } @@ -138,7 +138,8 @@ private void RunOver(Vector2 targetPos) { - var distance = (int)(Master.Holster.ActiveWeapon.Attribute.MinDistance * 0.7f); + var weapon = Master.Holster.ActiveWeapon; + var distance = (int)(weapon == null ? 150 : (weapon.Attribute.MinDistance * 0.7f)); _nextPosition = new Vector2( targetPos.X + Utils.RandRangeInt(-distance, distance), targetPos.Y + Utils.RandRangeInt(-distance, distance) diff --git a/DungeonShooting_Godot/src/game/role/enemy/state/AiTailAfterState.cs b/DungeonShooting_Godot/src/game/role/enemy/state/AiTailAfterState.cs index e5b4009..7d92d9f 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/state/AiTailAfterState.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/state/AiTailAfterState.cs @@ -65,7 +65,7 @@ { //计算移动 var nextPos = Master.NavigationAgent2D.GetNextPathPosition(); - Master.AnimatedSprite.Animation = AnimatorNames.Run; + Master.AnimatedSprite.Play(AnimatorNames.Run); Master.BasisVelocity = (nextPos - Master.GlobalPosition - Master.NavigationPoint.Position).Normalized() * Master.MoveSpeed; } diff --git a/DungeonShooting_Godot/src/game/room/RoomManager.cs b/DungeonShooting_Godot/src/game/room/RoomManager.cs index a3693df..2c282da 100644 --- a/DungeonShooting_Godot/src/game/room/RoomManager.cs +++ b/DungeonShooting_Godot/src/game/room/RoomManager.cs @@ -63,7 +63,7 @@ //创建玩家 Player = new Player(); - Player.Position = new Vector2(100, 100); + Player.Position = new Vector2(80, 80); Player.Name = "Player"; Player.PutDown(RoomLayerEnum.YSortLayer); } @@ -100,19 +100,19 @@ //播放bgm SoundManager.PlayMusic(ResourcePath.resource_sound_bgm_Intro_ogg, -17f); - // var enemy1 = new Enemy(); - // enemy1.Name = "Enemy"; - // enemy1.PutDown(new Vector2(100, 100)); - // enemy1.PickUpWeapon(WeaponManager.GetGun("1003")); - // enemy1.PickUpWeapon(WeaponManager.GetGun("1001")); + Player.PickUpWeapon(WeaponManager.GetGun("1003")); + Player.PickUpWeapon(WeaponManager.GetGun("1004")); - // for (int i = 0; i < 10; i++) + var enemy1 = new Enemy(); + enemy1.PutDown(new Vector2(100, 100), RoomLayerEnum.YSortLayer); + //enemy1.PickUpWeapon(WeaponManager.GetGun("1001")); + + // for (int i = 0; i < 3; i++) // { // var enemyTemp = new Enemy(); - // enemyTemp.Name = "EnemyTemp" + i; - // enemyTemp.PutDown(new Vector2(150 + (i + 1) * 20, 300)); - // enemyTemp.PickUpWeapon(WeaponManager.GetGun("1003")); - // enemyTemp.PickUpWeapon(WeaponManager.GetGun("1001")); + // enemyTemp.PutDown(new Vector2(30 + (i + 1) * 20, 30), RoomLayerEnum.YSortLayer); + // // enemyTemp.PickUpWeapon(WeaponManager.GetGun("1003")); + // // enemyTemp.PickUpWeapon(WeaponManager.GetGun("1001")); // } // var enemy2 = new Enemy();