mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 01:55:54 +00:00
Working rotating turrets
This commit is contained in:
parent
8889a2cdac
commit
1e5075eeb2
12 changed files with 278 additions and 66 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Godot.NET.Sdk/4.4.0">
|
||||
<Project Sdk="Godot.NET.Sdk/4.4.1">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ _name = "Intro"
|
|||
[sub_resource type="Resource" id="Resource_cfhv5"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
RemoveEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0k62o"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -34,8 +34,8 @@ StartData = SubResource("Resource_cfhv5")
|
|||
[sub_resource type="Resource" id="Resource_tpb7s"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
RemoveEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_edoov"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -47,8 +47,8 @@ StartData = SubResource("Resource_tpb7s")
|
|||
[sub_resource type="Resource" id="Resource_1sw5g"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 255
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
RemoveEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_47bot"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -61,7 +61,7 @@ StartData = SubResource("Resource_1sw5g")
|
|||
script = ExtResource("1_ov731")
|
||||
EggIndex = 2
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([ExtResource("3_fydgr"), ExtResource("4_38yta"), ExtResource("5_em757"), ExtResource("6_sdmg8")])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_mgdm6"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -79,8 +79,8 @@ _name = "Rebel Base"
|
|||
[sub_resource type="Resource" id="Resource_maxpt"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
RemoveEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_pein5"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -117,7 +117,7 @@ _name = "Default Scene"
|
|||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([ExtResource("7_b3oo5")])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = []
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6ijnv"]
|
||||
script = ExtResource("2_tnajf")
|
||||
|
|
@ -136,8 +136,8 @@ metadata/_custom_type_script = "uid://dnthdjrx78u6m"
|
|||
[sub_resource type="Resource" id="Resource_7sue8"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 255
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
RemoveEquipment = []
|
||||
metadata/_custom_type_script = "uid://mja0rk7n2kln"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ognca"]
|
||||
|
|
@ -151,8 +151,8 @@ metadata/_custom_type_script = "uid://dnthdjrx78u6m"
|
|||
[sub_resource type="Resource" id="Resource_olpjo"]
|
||||
script = ExtResource("1_ov731")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
RemoveEquipment = Array[ExtResource("2_bkci5")]([])
|
||||
StartingEquipment = []
|
||||
RemoveEquipment = []
|
||||
metadata/_custom_type_script = "uid://mja0rk7n2kln"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nbnej"]
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
[ext_resource type="Script" uid="uid://dn6dbog1s2818" path="res://Scripts/Components/FSM/Enemy/EnemyStateMachine.cs" id="3_x4aey"]
|
||||
[ext_resource type="Script" uid="uid://rrelumir3g6n" path="res://Scripts/Components/FSM/Enemy/Init.cs" id="4_kkydi"]
|
||||
[ext_resource type="Script" uid="uid://bjrh5q24nuoec" path="res://Scripts/Components/FSM/Enemy/Idle.cs" id="5_mjnu8"]
|
||||
[ext_resource type="Script" uid="uid://dbmc3klko5x18" path="res://Scripts/Components/FSM/Enemy/Alert.cs" id="6_yl0md"]
|
||||
[ext_resource type="Script" uid="uid://7mig30eneu8x" path="res://Scripts/Components/FSM/Enemy/Shooting.cs" id="7_xa3rc"]
|
||||
[ext_resource type="Script" uid="uid://dn05b1fbc6ip5" path="res://Scripts/Components/FSM/Enemy/Turret/TurretAlert.cs" id="6_q7y0e"]
|
||||
[ext_resource type="Script" uid="uid://biwpcnt2rhw23" path="res://Scripts/Components/FSM/Enemy/Turret/TurretShooting.cs" id="7_q7y0e"]
|
||||
[ext_resource type="Script" uid="uid://4hwtlc1ftjsc" path="res://Scripts/Components/FSM/Enemy/Dead.cs" id="8_itp26"]
|
||||
[ext_resource type="Script" uid="uid://dj37rup1ibnn6" path="res://Scripts/Components/FSM/Enemy/Controlled.cs" id="9_uk6hn"]
|
||||
[ext_resource type="Texture2D" uid="uid://b58oxkofm64o7" path="res://ExternalMaterial/WallTurret/WallTurret_Small.png" id="10_q7y0e"]
|
||||
|
|
@ -157,20 +157,18 @@ PlayerDetection = NodePath("../../PlayerDetection")
|
|||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
_moduleNodes = [NodePath("../../AlarmModule"), NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="Alert" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "NavigationModule", "_moduleNodes")]
|
||||
script = ExtResource("6_yl0md")
|
||||
[node name="Alert" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "_moduleNodes")]
|
||||
script = ExtResource("6_q7y0e")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
PlayerDetection = NodePath("../../PlayerDetection")
|
||||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
NavigationModule = NodePath("../../NavigationModule")
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
[node name="Shooting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "NavigationModule", "EquippedWeapon", "_moduleNodes")]
|
||||
script = ExtResource("7_xa3rc")
|
||||
[node name="Shooting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "EquippedWeapon", "_moduleNodes")]
|
||||
script = ExtResource("7_q7y0e")
|
||||
StorageModule = NodePath("../../Storage")
|
||||
PlayerDetection = NodePath("../../PlayerDetection")
|
||||
DamageReceiver = NodePath("../../DamageReceiver")
|
||||
NavigationModule = NodePath("../../NavigationModule")
|
||||
EquippedWeapon = NodePath("../../EnemyWeapon")
|
||||
_moduleNodes = [NodePath("../../AnimationModule")]
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
[ext_resource type="PackedScene" uid="uid://cl7s06sk106uo" path="res://Scenes/Props/VendingMachine.tscn" id="6_70a8f"]
|
||||
[ext_resource type="PackedScene" uid="uid://4q82gggqax87" path="res://Scenes/Items/Cheat_Gun_Pickup.tscn" id="6_pys6w"]
|
||||
[ext_resource type="PackedScene" uid="uid://djf0y08ix66fn" path="res://Scenes/Interactable/Chest.tscn" id="7_kublc"]
|
||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="8_5uxd1"]
|
||||
[ext_resource type="Resource" uid="uid://cltxhkrqp055v" path="res://Resources/Items/Money_Pickup.tres" id="9_5yebg"]
|
||||
[ext_resource type="Resource" uid="uid://cajqlnyvlmybe" path="res://Resources/Items/IcicleRepeater_Improved.tres" id="10_6gtn1"]
|
||||
[ext_resource type="Resource" uid="uid://dwwbyyy3fo4bt" path="res://Resources/Items/IcicleRepeater_Advanced.tres" id="11_0a3am"]
|
||||
|
|
@ -24,6 +23,7 @@
|
|||
[ext_resource type="Resource" uid="uid://diqm2ju0xakkt" path="res://Resources/Items/Yin_Yang_Ammo.tres" id="19_ii24s"]
|
||||
[ext_resource type="Resource" uid="uid://cfod8kephnio6" path="res://Resources/Items/Nuclear_Ammo_Pickup.tres" id="20_15ruc"]
|
||||
[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="21_5uxd1"]
|
||||
[ext_resource type="PackedScene" uid="uid://8ab7omgqeodu" path="res://Scenes/Actors/Wall_Turret.tscn" id="23_5uxd1"]
|
||||
[ext_resource type="Script" uid="uid://cqoqovfvk83wn" path="res://Scripts/Actors/ItemMarker.cs" id="25_5uxd1"]
|
||||
[ext_resource type="Resource" uid="uid://ckfqrq8a0uj1t" path="res://Resources/Items/LaserWeapon.tres" id="26_iyfx3"]
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ position = Vector2(275, -100)
|
|||
|
||||
[node name="Chest" parent="Actors" instance=ExtResource("7_kublc")]
|
||||
position = Vector2(220, -109)
|
||||
LootTable = Array[ExtResource("8_5uxd1")]([ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("10_6gtn1"), ExtResource("11_0a3am"), ExtResource("12_t3lr8"), ExtResource("13_ii24s"), ExtResource("14_15ruc"), ExtResource("15_5uxd1"), ExtResource("16_iyfx3"), ExtResource("17_45mmk"), ExtResource("18_ipsj4"), ExtResource("19_ii24s"), ExtResource("19_ii24s"), ExtResource("19_ii24s"), ExtResource("20_15ruc"), ExtResource("20_15ruc"), ExtResource("20_15ruc"), ExtResource("21_5uxd1"), ExtResource("21_5uxd1"), ExtResource("21_5uxd1"), ExtResource("26_iyfx3")])
|
||||
LootTable = [ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("9_5yebg"), ExtResource("10_6gtn1"), ExtResource("11_0a3am"), ExtResource("12_t3lr8"), ExtResource("13_ii24s"), ExtResource("14_15ruc"), ExtResource("15_5uxd1"), ExtResource("16_iyfx3"), ExtResource("17_45mmk"), ExtResource("18_ipsj4"), ExtResource("19_ii24s"), ExtResource("19_ii24s"), ExtResource("19_ii24s"), ExtResource("20_15ruc"), ExtResource("20_15ruc"), ExtResource("20_15ruc"), ExtResource("21_5uxd1"), ExtResource("21_5uxd1"), ExtResource("21_5uxd1"), ExtResource("26_iyfx3")]
|
||||
|
||||
[node name="Label" type="Label" parent="Actors"]
|
||||
offset_left = 153.0
|
||||
|
|
@ -87,6 +87,9 @@ text = "Press Q to freeze enemy bullets
|
|||
(uses 5 shield charges)"
|
||||
label_settings = ExtResource("14_c0yr1")
|
||||
|
||||
[node name="WallTurret" parent="Actors" instance=ExtResource("23_5uxd1")]
|
||||
position = Vector2(256, 45)
|
||||
|
||||
[node name="EnemySpawners" type="Node2D" parent="."]
|
||||
|
||||
[node name="PlayerEnterDetector" type="Area2D" parent="."]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=169 format=4 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=170 format=4 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_ksslq"]
|
||||
|
|
@ -51,6 +51,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://d0yes7huiyisw" path="res://Scenes/Items/Blue_Keycard.tscn" id="35_rblsn"]
|
||||
[ext_resource type="PackedScene" uid="uid://r25rq6ijgm6m" path="res://Scenes/Items/Green_Keycard.tscn" id="36_f8fh1"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnbtou2fklyvp" path="res://Scenes/Actors/alarm_sign.tscn" id="36_rd6f6"]
|
||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="36_w8skm"]
|
||||
[ext_resource type="PackedScene" uid="uid://dsbk2l40er2da" path="res://Scenes/Props/Box_Blue.tscn" id="37_gtga7"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8lgk4wnyi1e6" path="res://Scenes/Actors/HealthStation.tscn" id="38_kuhg5"]
|
||||
[ext_resource type="PackedScene" uid="uid://cl4r3t4c1klv7" path="res://Scenes/Interactable/Switch_Box.tscn" id="38_qnbhd"]
|
||||
|
|
@ -300,7 +301,7 @@ ActivationType = 0
|
|||
Targets = Array[NodePath]([NodePath("../Rumia")])
|
||||
WaitForCompletion = true
|
||||
|
||||
[sub_resource type="Resource" id="Resource_7lma1"]
|
||||
[sub_resource type="Resource" id="Resource_jm0wb"]
|
||||
resource_local_to_scene = true
|
||||
script = ExtResource("49_0si7g")
|
||||
Target = NodePath(".")
|
||||
|
|
@ -691,7 +692,7 @@ position = Vector2(-1832, -99)
|
|||
|
||||
[node name="Chest2" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-679, -408)
|
||||
LootTable = [ExtResource("76_dskij"), ExtResource("77_wma5c"), ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("77_wma5c"), ExtResource("77_wma5c"), ExtResource("77_wma5c"), ExtResource("77_wma5c"), ExtResource("76_dskij")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("76_dskij"), ExtResource("77_wma5c"), ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("94_gd7x4"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("6_khabp"), ExtResource("77_wma5c"), ExtResource("77_wma5c"), ExtResource("77_wma5c"), ExtResource("77_wma5c"), ExtResource("76_dskij")])
|
||||
|
||||
[node name="Valve" parent="Parallax2D/Factory Tilemaps/Debug Room" node_paths=PackedStringArray("Target") instance=ExtResource("48_8usll")]
|
||||
position = Vector2(-666, -545)
|
||||
|
|
@ -1009,7 +1010,7 @@ position = Vector2(-1488, -544)
|
|||
|
||||
[node name="Chest" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-920, -424)
|
||||
LootTable = [ExtResource("27_y1lom"), ExtResource("28_u0dff"), ExtResource("29_wb5l5"), ExtResource("30_0d2o6"), ExtResource("5_nqier")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("27_y1lom"), ExtResource("28_u0dff"), ExtResource("29_wb5l5"), ExtResource("30_0d2o6"), ExtResource("5_nqier")])
|
||||
|
||||
[node name="RedKeycard_Switch_2" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Target") instance=ExtResource("17_e3v0b")]
|
||||
position = Vector2(-1095, 132)
|
||||
|
|
@ -1259,7 +1260,7 @@ Events = Array[ExtResource("62_w8skm")]([SubResource("Resource_068l7"), SubResou
|
|||
|
||||
[node name="BossBattleStartScript" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("43_kf3qc")]
|
||||
position = Vector2(-1487, -396)
|
||||
Events = Array[ExtResource("62_w8skm")]([SubResource("Resource_4f4id"), SubResource("Resource_s2o7m"), SubResource("Resource_b1dht"), SubResource("Resource_xrgpy"), SubResource("Resource_7lma1")])
|
||||
Events = Array[ExtResource("62_w8skm")]([SubResource("Resource_4f4id"), SubResource("Resource_s2o7m"), SubResource("Resource_b1dht"), SubResource("Resource_xrgpy"), SubResource("Resource_jm0wb")])
|
||||
|
||||
[node name="Enemy13" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("47_u1ve6")]
|
||||
position = Vector2(-1657, -788)
|
||||
|
|
@ -1383,7 +1384,7 @@ position = Vector2(-2000, -736)
|
|||
[node name="ControlPad8" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("12_hfkf1")]
|
||||
position = Vector2(-2027, -735)
|
||||
Targets = [NodePath("../HorizontalForceField")]
|
||||
Requirements = [ExtResource("84_ma1ta")]
|
||||
Requirements = Array[ExtResource("36_w8skm")]([ExtResource("84_ma1ta")])
|
||||
|
||||
[node name="Ammo6" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("34_17pjh")]
|
||||
position = Vector2(-872, -220)
|
||||
|
|
@ -1443,35 +1444,35 @@ position = Vector2(-1624, -813)
|
|||
|
||||
[node name="Chest3" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-376, 54)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")])
|
||||
|
||||
[node name="Chest5" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-1048, -139)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g"), ExtResource("4_swym2")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g"), ExtResource("4_swym2")])
|
||||
|
||||
[node name="Chest6" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-2104, -362)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g"), ExtResource("4_swym2")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g"), ExtResource("4_swym2")])
|
||||
|
||||
[node name="Chest4" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-823, 67)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")])
|
||||
|
||||
[node name="Chest7" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-1417, 326)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")])
|
||||
|
||||
[node name="Chest10" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-1515, 408)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")])
|
||||
|
||||
[node name="Chest8" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-1544, 552)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")])
|
||||
|
||||
[node name="Chest9" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-1384, 231)
|
||||
LootTable = [ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")]
|
||||
LootTable = Array[ExtResource("36_w8skm")]([ExtResource("6_khabp"), ExtResource("94_gd7x4"), ExtResource("95_srv0g")])
|
||||
|
||||
[node name="Ammo13" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("34_17pjh")]
|
||||
position = Vector2(-392, 52)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ public partial class Alert : EnemyStateBase
|
|||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
GD.Print($"Entered {Name}");
|
||||
NavigationModule.Init(MainObject);
|
||||
|
||||
PlayerDetection.SetRange(StorageModule.Root.EnemyResource.PlayerDetectionRange);
|
||||
|
|
@ -50,13 +49,11 @@ public partial class Alert : EnemyStateBase
|
|||
private void PlayerDetectionOnPlayerOutOfRange()
|
||||
{
|
||||
_isPlayerInRange = false;
|
||||
GD.Print("Player out of range");
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
GD.Print($"Exited {Name}");
|
||||
PlayerDetection.PlayerInRange -= PlayerDetectionOnPlayerInRange;
|
||||
|
||||
PlayerDetection.PlayerOutOfRange -= PlayerDetectionOnPlayerOutOfRange;
|
||||
|
|
@ -69,7 +66,6 @@ public partial class Alert : EnemyStateBase
|
|||
private void PlayerDetectionOnPlayerInRange()
|
||||
{
|
||||
//_isPlayerInRange = true;
|
||||
GD.Print("Player In Range");
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
|
|
@ -77,7 +73,6 @@ public partial class Alert : EnemyStateBase
|
|||
base.PhysicsProcessState(delta);
|
||||
if (PlayerDetection.IsPlayerInRange(StorageModule.Root.EnemyResource.ViewRange) && PlayerDetection.IsPlayerInSight())
|
||||
{
|
||||
GD.Print("Player is in sight, shooting");
|
||||
StateMachine.SetState(EnemyState.Shooting);
|
||||
return;
|
||||
}
|
||||
|
|
@ -86,7 +81,6 @@ public partial class Alert : EnemyStateBase
|
|||
if (this.GlobalPosition.DistanceTo(GameManager.Instance.PlayerPosition.Value) >=
|
||||
StorageModule.Root.EnemyResource.PlayerDisengageRange)
|
||||
{
|
||||
GD.Print("Player is out of sight, idling");
|
||||
StateMachine.SetState(EnemyState.Idle);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,8 +172,6 @@ public partial class Shooting : EnemyStateBase
|
|||
if (!PlayerDetection.LastKnownPlayerPosition.HasValue) return;
|
||||
|
||||
var direction = GetShootDirection();
|
||||
|
||||
|
||||
|
||||
// Shoot at the player's last known position
|
||||
EquippedWeapon.ShootDirection = direction;
|
||||
|
|
|
|||
97
Scripts/Components/FSM/Enemy/Turret/TurretAlert.cs
Normal file
97
Scripts/Components/FSM/Enemy/Turret/TurretAlert.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy.Turret;
|
||||
|
||||
public partial class TurretAlert : EnemyStateBase
|
||||
{
|
||||
public override EnemyState StateId => EnemyState.Alert;
|
||||
|
||||
[Export]
|
||||
public EnemyStorageModule StorageModule { get; private set; }
|
||||
|
||||
[Export]
|
||||
public PlayerDetectionModule PlayerDetection { get; private set; }
|
||||
|
||||
[Export]
|
||||
public GenericDamageReceiver DamageReceiver { get; private set; }
|
||||
|
||||
|
||||
private bool _isPlayerInRange = false;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
||||
PlayerDetection.SetRange(StorageModule.Root.EnemyResource.PlayerDetectionRange);
|
||||
|
||||
PlayerDetection.PlayerInRange += PlayerDetectionOnPlayerInRange;
|
||||
|
||||
PlayerDetection.PlayerOutOfRange += PlayerDetectionOnPlayerOutOfRange;
|
||||
|
||||
DamageReceiver.ChangeState(true);
|
||||
|
||||
DamageReceiver.HealthProvider.ResourceDepleted += HealthProviderOnResourceDepleted;
|
||||
}
|
||||
|
||||
private void HealthProviderOnResourceDepleted()
|
||||
{
|
||||
ChangeState(EnemyState.Dead);
|
||||
}
|
||||
|
||||
private void PlayerDetectionOnPlayerOutOfRange()
|
||||
{
|
||||
_isPlayerInRange = false;
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
PlayerDetection.PlayerInRange -= PlayerDetectionOnPlayerInRange;
|
||||
|
||||
PlayerDetection.PlayerOutOfRange -= PlayerDetectionOnPlayerOutOfRange;
|
||||
|
||||
DamageReceiver.HealthProvider.ResourceDepleted -= HealthProviderOnResourceDepleted;
|
||||
DamageReceiver.ChangeState(false);
|
||||
}
|
||||
|
||||
private void PlayerDetectionOnPlayerInRange()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
base.PhysicsProcessState(delta);
|
||||
if (PlayerDetection.IsPlayerInRange(StorageModule.Root.EnemyResource.ViewRange) && PlayerDetection.IsPlayerInSight())
|
||||
{
|
||||
|
||||
StateMachine.SetState(EnemyState.Shooting);
|
||||
return;
|
||||
}
|
||||
|
||||
// if player is outside disengage range, change to idle (later on, search)
|
||||
if (this.GlobalPosition.DistanceTo(GameManager.Instance.PlayerPosition.Value) >=
|
||||
StorageModule.Root.EnemyResource.PlayerDisengageRange)
|
||||
{
|
||||
|
||||
StateMachine.SetState(EnemyState.Idle);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set facing direction towards player
|
||||
if (PlayerDetection.LastKnownPlayerPosition.HasValue)
|
||||
{
|
||||
StorageModule.FacingDirection =
|
||||
(PlayerDetection.LastKnownPlayerPosition.Value - MainObject.GlobalPosition).Normalized(); //MainObject.Velocity.SnapToCardinal().Normalized();
|
||||
StorageModule.AimingDirection = StorageModule.FacingDirection;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessState(double delta)
|
||||
{
|
||||
base.ProcessState(delta);
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Enemy/Turret/TurretAlert.cs.uid
Normal file
1
Scripts/Components/FSM/Enemy/Turret/TurretAlert.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dn05b1fbc6ip5
|
||||
110
Scripts/Components/FSM/Enemy/Turret/TurretShooting.cs
Normal file
110
Scripts/Components/FSM/Enemy/Turret/TurretShooting.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy.Turret;
|
||||
|
||||
public partial class TurretShooting : EnemyStateBase
|
||||
{
|
||||
public override EnemyState StateId => EnemyState.Shooting;
|
||||
|
||||
[Export]
|
||||
public EnemyStorageModule StorageModule { get; private set; }
|
||||
|
||||
[Export]
|
||||
public PlayerDetectionModule PlayerDetection { get; private set; }
|
||||
|
||||
[Export]
|
||||
public GenericDamageReceiver DamageReceiver { get; private set; }
|
||||
|
||||
[Export] public Weapon EquippedWeapon;
|
||||
|
||||
private bool _isPlayerInRange = false;
|
||||
|
||||
private double _responseTimer = 0;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
||||
PlayerDetection.PlayerOutOfRange += PlayerDetectionOnPlayerOutOfRange;
|
||||
|
||||
DamageReceiver.ChangeState(true);
|
||||
|
||||
DamageReceiver.HealthProvider.ResourceDepleted += HealthProviderOnResourceDepleted;
|
||||
|
||||
EquippedWeapon.WeaponData = StorageModule.Root.EnemyResource.Weapon;
|
||||
|
||||
_responseTimer = 0;
|
||||
}
|
||||
|
||||
private void HealthProviderOnResourceDepleted()
|
||||
{
|
||||
ChangeState(EnemyState.Dead);
|
||||
}
|
||||
|
||||
private void PlayerDetectionOnPlayerOutOfRange()
|
||||
{
|
||||
StateMachine.SetState(EnemyState.Alert);
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
base.ExitState();
|
||||
|
||||
PlayerDetection.PlayerOutOfRange -= PlayerDetectionOnPlayerOutOfRange;
|
||||
|
||||
DamageReceiver.HealthProvider.ResourceDepleted -= HealthProviderOnResourceDepleted;
|
||||
|
||||
DamageReceiver.ChangeState(false);
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcessState(double delta)
|
||||
{
|
||||
base.PhysicsProcessState(delta);
|
||||
|
||||
if (PlayerDetection.IsPlayerInRange(StorageModule.Root.EnemyResource.ViewRange) && PlayerDetection.IsPlayerInSight())
|
||||
{
|
||||
// SHOOT
|
||||
Shoot();
|
||||
}
|
||||
else
|
||||
{
|
||||
StateMachine.SetState(EnemyState.Alert);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Vector2 GetShootDirection()
|
||||
{
|
||||
if (StorageModule.EnemyData.PredictPlayer && PlayerDetection.LastKnowPlayerVelocity.HasValue)
|
||||
{
|
||||
var predictedDirection = MathFunctions.PredictInterceptPosition(MainObject.GlobalPosition,
|
||||
PlayerDetection.LastKnownPlayerPosition.Value, PlayerDetection.LastKnowPlayerVelocity.Value,
|
||||
EquippedWeapon.WeaponData.BulletData.BulletSpeed);
|
||||
if (predictedDirection.HasValue) return (predictedDirection.Value - MainObject.GlobalPosition).Normalized();
|
||||
|
||||
}
|
||||
|
||||
return ( PlayerDetection.LastKnownPlayerPosition.Value - MainObject.GlobalPosition).Normalized();
|
||||
}
|
||||
|
||||
private void Shoot()
|
||||
{
|
||||
if (EquippedWeapon == null) return;
|
||||
if (!PlayerDetection.LastKnownPlayerPosition.HasValue) return;
|
||||
|
||||
var direction = GetShootDirection();
|
||||
|
||||
// Shoot at the player's last known position
|
||||
EquippedWeapon.ShootDirection = direction;
|
||||
//StorageModule.FacingDirection = direction;
|
||||
StorageModule.FacingDirection = direction;
|
||||
StorageModule.AimingDirection = direction;
|
||||
|
||||
EquippedWeapon.Shoot();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://biwpcnt2rhw23
|
||||
|
|
@ -8,24 +8,24 @@ public partial class TurretAnimationModule : ModuleBase<EnemyState, CharacterBod
|
|||
{
|
||||
private IStateMachine<EnemyState, CharacterBody2D> _machine;
|
||||
[Export] public PlayerAnimationProvider AnimationProvider { get; set; }
|
||||
|
||||
|
||||
[Export] public EnemyStorageModule StorageModule { get; set; }
|
||||
[Export] public ActorResourceProvider HealthProvider { get; set; }
|
||||
|
||||
|
||||
|
||||
[Export] public Vector2 TurretFacingDirection { get; set; } = Vector2.Down;
|
||||
[Export] public float SweepAngle = 90f; // In degrees
|
||||
[Export] public float SweepSpeed = 1f; // Speed of sweeping
|
||||
[Export] public bool Debug = false; // Enable debug lines
|
||||
[Export] public float SweepSpeed = 1f; // Speed of sweeping
|
||||
[Export] public bool Debug = false; // Enable debug lines
|
||||
//[Export] public NodePath SpritePath;
|
||||
|
||||
|
||||
private float _currentAngle;
|
||||
private float _sweepDirection = 1f;
|
||||
private float _raycastLength;
|
||||
|
||||
|
||||
public override void EnterState(EnemyState state)
|
||||
{
|
||||
AnimationProvider.SetAnimation(StorageModule.AimingDirection);
|
||||
AnimationProvider.SetAnimation(Vector2.Zero);
|
||||
//AnimationProvider.SetAnimation(StorageModule.AimingDirection);
|
||||
//AnimationProvider.SetAnimation(Vector2.Zero);
|
||||
if (HealthProvider is not null)
|
||||
{
|
||||
HealthProvider.ResourceDecreased += HealthProviderOnResourceDecreased;
|
||||
|
|
@ -39,7 +39,7 @@ public partial class TurretAnimationModule : ModuleBase<EnemyState, CharacterBod
|
|||
|
||||
public override void ExitState(EnemyState state)
|
||||
{
|
||||
AnimationProvider.SetAnimation(Vector2.Zero);
|
||||
//AnimationProvider.SetAnimation(Vector2.Zero);
|
||||
if (HealthProvider is not null)
|
||||
{
|
||||
HealthProvider.ResourceDecreased -= HealthProviderOnResourceDecreased;
|
||||
|
|
@ -53,17 +53,27 @@ public partial class TurretAnimationModule : ModuleBase<EnemyState, CharacterBod
|
|||
|
||||
public override void Process(double delta)
|
||||
{
|
||||
AnimationProvider.SetAnimation(StorageModule.AimingDirection);
|
||||
if (StorageModule.AimingDirection == Vector2.Zero || TurretFacingDirection == Vector2.Zero)
|
||||
return;
|
||||
|
||||
if (_machine.MainObject.Velocity == Vector2.Zero)
|
||||
{
|
||||
AnimationProvider.SetAnimation(Vector2.Zero);
|
||||
}
|
||||
// Calculate the angle between the turret's facing direction and the aim direction
|
||||
float angleToTarget = TurretFacingDirection.AngleTo(StorageModule.AimingDirection); // radians
|
||||
|
||||
// Clamp the angle to within the sweep cone
|
||||
float halfSweepRad = Mathf.DegToRad(SweepAngle / 2f);
|
||||
float clampedAngle = Mathf.Clamp(angleToTarget, -halfSweepRad, halfSweepRad);
|
||||
|
||||
// Convert to degrees before passing to SweepSprite
|
||||
float clampedAngleDeg = Mathf.RadToDeg(clampedAngle);
|
||||
// Update the sprite based on this clamped angle
|
||||
AnimationProvider.SweepSprite(clampedAngleDeg, SweepAngle);
|
||||
|
||||
|
||||
//AnimationProvider.SetAnimation(StorageModule.AimingDirection);
|
||||
}
|
||||
|
||||
public override void PhysicsProcess(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Sweep(float delta)
|
||||
|
|
@ -78,7 +88,7 @@ public partial class TurretAnimationModule : ModuleBase<EnemyState, CharacterBod
|
|||
_currentAngle = Mathf.Clamp(_currentAngle, -halfAngle, halfAngle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawDebugLine(Vector2 endPoint)
|
||||
{
|
||||
// Request the node to redraw
|
||||
|
|
@ -90,7 +100,7 @@ public partial class TurretAnimationModule : ModuleBase<EnemyState, CharacterBod
|
|||
{
|
||||
AnimationProvider.SweepSprite(_currentAngle, SweepAngle);
|
||||
}
|
||||
|
||||
|
||||
private Vector2 _debugLineEndPoint;
|
||||
|
||||
public override void _Draw()
|
||||
|
|
@ -100,5 +110,4 @@ public partial class TurretAnimationModule : ModuleBase<EnemyState, CharacterBod
|
|||
DrawLine(Vector2.Zero, ToLocal(_debugLineEndPoint), Colors.Red, 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue