Refactor Player class to use components, also use components in Enemy class types and fiddle with boss structure

This commit is contained in:
2025-10-22 02:41:08 -07:00
parent 44fd8c82b0
commit 6ec45c4805
85 changed files with 941 additions and 1449 deletions

View File

@@ -27,14 +27,18 @@ public partial class BossRoomA : Node3D, IBossRoom, IDungeonFloor
[Node] public Node3D GateCollision { get; set; } = default!;
[Node] public MeshInstance3D LOCKEDGATE { get; set; } = default!;
[Node] private Area3D _exit { get; set; } = default!;
public ImmutableList<IDungeonRoom> Rooms { get; }
public bool FloorIsLoaded { get; set; }
public void Setup()
public void OnReady()
{
ActivateTrap.BodyEntered += ActivateTrap_BodyEntered;
_exit.AreaEntered += Exit_AreaEntered;
OxFace.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
HorseFace.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
}
private void ActivateTrap_BodyEntered(Node3D body)
@@ -51,9 +55,16 @@ public partial class BossRoomA : Node3D, IBossRoom, IDungeonFloor
HorseFace.StartFight();
}
private void CheckForBossFightEnd()
{
if (OxFace.HealthComponent.CurrentHP.Value <= 0 && HorseFace.HealthComponent.CurrentHP.Value <= 0)
OnBossFightEnded();
}
public void OnBossFightEnded()
{
GateCollision.CallDeferred(MethodName.QueueFree);
LOCKEDGATE.Hide();
}
public void ExitReached()

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=274 format=4 uid="uid://5ja3qxn8h7iw"]
[gd_scene load_steps=276 format=4 uid="uid://5ja3qxn8h7iw"]
[ext_resource type="Script" uid="uid://tqyybt313web" path="res://src/map/dungeon/code/BossRoomA.cs" id="1_0h3lb"]
[ext_resource type="Texture2D" uid="uid://vjbe1lg810gh" path="res://src/map/dungeon/models/Special Floors & Rooms/Boss Floor A/15_A1_BOSS FLOOR A_VER_swirled_column.png" id="2_06eum"]
@@ -4280,6 +4280,13 @@ shader_parameter/uv1_offset = Vector3(0, 0, 0)
shader_parameter/color1 = Color(1, 1, 1, 1)
shader_parameter/color2 = Color(1, 1, 1, 1)
[sub_resource type="NavigationMesh" id="NavigationMesh_eanap"]
vertices = PackedVector3Array(-148.246, 0.5, 7.6195, -148.246, 0.5, 31.6195, -99.246, 0.5, 31.6195, -99.246, 0.5, 7.6195)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)]
[sub_resource type="PlaneMesh" id="PlaneMesh_m8pjb"]
size = Vector2(50, 25)
[node name="Boss Floor A" type="Node3D"]
script = ExtResource("1_0h3lb")
@@ -4445,7 +4452,8 @@ libraries = {
[node name="Boss Floor 1 Ver_ 3" type="Node3D" parent="Model"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.547867, -15.9756, 0)
[node name="LOCKED GATE" type="MeshInstance3D" parent="Model/Boss Floor 1 Ver_ 3"]
[node name="LOCKEDGATE" type="MeshInstance3D" parent="Model/Boss Floor 1 Ver_ 3"]
unique_name_in_owner = true
transform = Transform3D(0.816274, 0, 0, 0, 1.99383, 0, 0, 0, 1.99383, -145.76, 15.2976, 17.4223)
mesh = SubResource("ArrayMesh_j7o60")
skeleton = NodePath("")
@@ -4855,14 +4863,18 @@ shape = SubResource("BoxShape3D_pkvyy")
[node name="HorseHeadStatue" parent="Room" instance=ExtResource("24_r1rk5")]
unique_name_in_owner = true
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -102.157, -2.30863, 13.0139)
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -102.157, -2.30863, 13.3664)
[node name="HorseFace" parent="Room" instance=ExtResource("25_a482y")]
unique_name_in_owner = true
transform = Transform3D(-6.55671e-09, 0, -0.15, 0, 0.15, 0, 0.15, 0, -6.55671e-09, -102.157, -0.510939, 13.0139)
transform = Transform3D(-6.55671e-09, 0, -0.15, 0, 0.15, 0, 0.15, 0, -6.55671e-09, -102.157, -0.510939, 13.3664)
visible = false
PrimaryAttackElementalType = 0
PrimaryAttackElementalDamageBonus = 1.0
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
AttackValue = null
DefenseValue = null
InitialHP = null
ExpAmount = null
[node name="OxFaceStatue" parent="Room" instance=ExtResource("26_futcf")]
unique_name_in_owner = true
@@ -4872,6 +4884,12 @@ transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -101.5
unique_name_in_owner = true
transform = Transform3D(-6.55671e-09, 0, -0.15, 0, 0.15, 0, 0.15, 0, -6.55671e-09, -101.703, -0.479859, 22.0955)
visible = false
PrimaryAttackElementalType = null
PrimaryAttackElementalDamageBonus = null
AttackValue = null
DefenseValue = null
InitialHP = null
ExpAmount = null
[node name="Exit" type="Area3D" parent="Room"]
unique_name_in_owner = true
@@ -4937,3 +4955,11 @@ transform = Transform3D(0.565, 0, 0, 0, 0.565, 0, 0, 0, 0.565, -92.0811, -2.7728
[node name="sarco" parent="." instance=ExtResource("59_ucaw1")]
transform = Transform3D(0.55, 0, 0, 0, 0.55, 0, 0, 0, 0.55, -92.04, -2.83756, 3.9847)
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="."]
navigation_mesh = SubResource("NavigationMesh_eanap")
[node name="MeshInstance3D" type="MeshInstance3D" parent="NavigationRegion3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -123.746, 0, 19.6195)
visible = false
mesh = SubResource("PlaneMesh_m8pjb")