Small Map Fixes
This commit is contained in:
@@ -31,53 +31,53 @@ public partial class BossRoomA : SpecialFloor, IBossRoom, IDungeonFloor
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
ActivateTrap.BodyEntered += ActivateTrap_BodyEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
OxFace.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
|
||||
HorseHead.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
|
||||
ActivateTrap.BodyEntered += ActivateTrap_BodyEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
OxFace.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
|
||||
HorseHead.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
|
||||
}
|
||||
|
||||
private void ActivateTrap_BodyEntered(Node3D body)
|
||||
{
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||
StartBossFight();
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||
StartBossFight();
|
||||
}
|
||||
|
||||
public void StartBossFight()
|
||||
{
|
||||
OxFaceStatue.Hide();
|
||||
HorseHeadStatue.Hide();
|
||||
OxFace.StartFight();
|
||||
HorseHead.StartFight();
|
||||
OxFaceStatue.Hide();
|
||||
HorseHeadStatue.Hide();
|
||||
OxFace.StartFight();
|
||||
HorseHead.StartFight();
|
||||
}
|
||||
|
||||
private void CheckForBossFightEnd()
|
||||
{
|
||||
if (OxFace.HealthComponent.CurrentHP.Value <= 0 && HorseHead.HealthComponent.CurrentHP.Value <= 0)
|
||||
OnBossFightEnded();
|
||||
if (OxFace.HealthComponent.CurrentHP.Value <= 0 && HorseHead.HealthComponent.CurrentHP.Value <= 0)
|
||||
OnBossFightEnded();
|
||||
}
|
||||
|
||||
public void OnBossFightEnded()
|
||||
{
|
||||
BossDoor.CallDeferred(MethodName.QueueFree);
|
||||
BossDoor.CallDeferred(MethodName.QueueFree);
|
||||
}
|
||||
|
||||
public void ExitReached()
|
||||
=> Game.FloorExitReached();
|
||||
=> Game.FloorExitReached();
|
||||
|
||||
private void Exit_AreaEntered(Area3D area)
|
||||
{
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
}
|
||||
|
||||
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawn.Rotation, new Vector3(PlayerSpawn.GlobalPosition.X, -2.5f, PlayerSpawn.GlobalPosition.Z)); }
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
OxFace.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||
HorseHead.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
OxFace.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||
HorseHead.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ public partial class BossRoomB : SpecialFloor, IBossRoom, IDungeonFloor
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
ActivateTrap.BodyEntered += ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
ActivateTrap.BodyEntered += ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
}
|
||||
|
||||
private void ActivateTrap_AreaEntered(Node3D area) => StartBossFight();
|
||||
@@ -35,21 +35,21 @@ public partial class BossRoomB : SpecialFloor, IBossRoom, IDungeonFloor
|
||||
|
||||
public void StartBossFight()
|
||||
{
|
||||
DemonWall.Activate();
|
||||
DemonWall.Activate();
|
||||
}
|
||||
|
||||
public void ExitReached()
|
||||
=> Game.FloorExitReached();
|
||||
=> Game.FloorExitReached();
|
||||
|
||||
private void Exit_AreaEntered(Area3D area)
|
||||
{
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,18 +18,18 @@ public partial class CorridorRoom : Node3D
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
if (_room != null)
|
||||
_room.BodyEntered += Room_BodyEntered;
|
||||
if (_room != null)
|
||||
_room.BodyEntered += Room_BodyEntered;
|
||||
}
|
||||
|
||||
private void Room_BodyEntered(Node3D body)
|
||||
{
|
||||
if (!Game.CurrentFloor.FloorIsLoaded)
|
||||
return;
|
||||
if (!Game.CurrentFloor.FloorIsLoaded)
|
||||
return;
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
_room.BodyEntered -= Room_BodyEntered;
|
||||
_room.BodyEntered -= Room_BodyEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,54 +19,54 @@ public partial class MonsterRoom : DungeonRoom
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
SpawnItems();
|
||||
SpawnItems();
|
||||
}
|
||||
|
||||
public void SpawnEnemies(Godot.Collections.Dictionary<EnemyType, float> enemyInfo)
|
||||
{
|
||||
if (enemyInfo == null || !enemyInfo.Any(x => x.Value > 0))
|
||||
return;
|
||||
if (enemyInfo == null || !enemyInfo.Any(x => x.Value > 0))
|
||||
return;
|
||||
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var enemySpawnPoints = EnemySpawnPoints.GetChildren();
|
||||
var numberOfEnemiesToSpawn = rng.RandiRange(1, enemySpawnPoints.Count);
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var enemySpawnPoints = EnemySpawnPoints.GetChildren();
|
||||
var numberOfEnemiesToSpawn = rng.RandiRange(1, enemySpawnPoints.Count);
|
||||
|
||||
foreach (var spawnPoint in enemySpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfEnemiesToSpawn <= 0)
|
||||
break;
|
||||
numberOfEnemiesToSpawn--;
|
||||
foreach (var spawnPoint in enemySpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfEnemiesToSpawn <= 0)
|
||||
break;
|
||||
numberOfEnemiesToSpawn--;
|
||||
|
||||
var index = rng.RandWeighted([.. enemyInfo.Values]);
|
||||
var selectedEnemy = enemyInfo.ElementAt((int)index);
|
||||
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(selectedEnemy.Key);
|
||||
instantiatedEnemy.Position = new Vector3(spawnPoint.Position.X, 0f, spawnPoint.Position.Z);
|
||||
AddChild(instantiatedEnemy);
|
||||
}
|
||||
var index = rng.RandWeighted([.. enemyInfo.Values]);
|
||||
var selectedEnemy = enemyInfo.ElementAt((int)index);
|
||||
var instantiatedEnemy = EnemyTypeToEnemyConverter.Convert(selectedEnemy.Key);
|
||||
instantiatedEnemy.Position = new Vector3(spawnPoint.Position.X, 0f, spawnPoint.Position.Z);
|
||||
AddChild(instantiatedEnemy);
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnItems()
|
||||
{
|
||||
if (ItemSpawnPoints == null)
|
||||
return;
|
||||
if (ItemSpawnPoints == null)
|
||||
return;
|
||||
|
||||
var itemSpawnPoints = ItemSpawnPoints.GetChildren();
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var numberOfItemsToSpawn = rng.RandiRange(1, itemSpawnPoints.Count);
|
||||
itemSpawnPoints.Shuffle();
|
||||
var database = ItemDatabase.Instance;
|
||||
foreach (var spawnPoint in itemSpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfItemsToSpawn <= 0)
|
||||
break;
|
||||
numberOfItemsToSpawn--;
|
||||
var itemSpawnPoints = ItemSpawnPoints.GetChildren();
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var numberOfItemsToSpawn = rng.RandiRange(1, itemSpawnPoints.Count);
|
||||
itemSpawnPoints.Shuffle();
|
||||
var database = ItemDatabase.Instance;
|
||||
foreach (var spawnPoint in itemSpawnPoints.Cast<Marker3D>())
|
||||
{
|
||||
if (numberOfItemsToSpawn <= 0)
|
||||
break;
|
||||
numberOfItemsToSpawn--;
|
||||
|
||||
var selectedItem = database.PickItem<InventoryItem>();
|
||||
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
|
||||
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);
|
||||
AddChild(duplicated);
|
||||
}
|
||||
var selectedItem = database.PickItem<InventoryItem>();
|
||||
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
|
||||
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);
|
||||
AddChild(duplicated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://dashmsecoojsf"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dashmsecoojsf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://csxfet8l04swm" path="res://src/map/dungeon/code/CorridorRoom.cs" id="1_hceu2"]
|
||||
[ext_resource type="PackedScene" uid="uid://k2ibaps2edtl" path="res://src/map/dungeon/models/Corridor Models/A2 Corridor Blocks/CA2_5BLOCK.glb" id="2_hceu2"]
|
||||
[ext_resource type="PackedScene" uid="uid://jx4x2weyky45" path="res://src/minimap/Map Revealer Cube.tscn" id="3_14lg2"]
|
||||
[ext_resource type="PackedScene" uid="uid://csye32n2nh7uo" path="res://src/map/dungeon/models/Corridor Models/A1 Corridor Blocks/CA1_5BLOCK.glb" id="4_083yc"]
|
||||
[ext_resource type="PackedScene" uid="uid://dn50mjadk31jn" path="res://src/minimap/Map Revealer Cube.tscn" id="3_14lg2"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_rd173"]
|
||||
size = Vector3(20.0077, 3.9892, 0.1)
|
||||
@@ -73,4 +72,4 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 0, -2)
|
||||
[node name="Reveal Cube5" parent="Room" instance=ExtResource("3_14lg2")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 0, -2)
|
||||
|
||||
[node name="CA1_5BLOCK" parent="Room" instance=ExtResource("4_083yc")]
|
||||
[editable path="Model/CA2_5BLOCK"]
|
||||
|
||||
@@ -148,6 +148,6 @@ mesh = SubResource("PlaneMesh_7cums")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Minimap" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 39.9422, 0, -22.6404)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 39.9422, -5.3305, -22.6404)
|
||||
layers = 2
|
||||
mesh = SubResource("PlaneMesh_axhvs")
|
||||
|
||||
@@ -1379,7 +1379,7 @@ shape = SubResource("CylinderShape3D_1ijgn")
|
||||
[node name="Spawn Points" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -52.6848, 0, 16.939)
|
||||
|
||||
[node name="PlayerSpawnPoint" type="Marker3D" parent="Spawn Points"]
|
||||
[node name="PlayerSpawn" type="Marker3D" parent="Spawn Points"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.72795, -2.29748, 0.329851)
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ shape = SubResource("ConcavePolygonShape3D_s7h55")
|
||||
|
||||
[node name="Spawn Points" type="Node3D" parent="."]
|
||||
|
||||
[node name="PlayerSpawnPoint" type="Marker3D" parent="Spawn Points"]
|
||||
[node name="PlayerSpawn" type="Marker3D" parent="Spawn Points"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.953, 0, 149.677)
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cxwnv6dh5iar2"
|
||||
path="res://.godot/imported/A2-Pit_lime_hand_relief.png-4f5f784ba7e998f94c40c7e70b269607.ctex"
|
||||
path.s3tc="res://.godot/imported/A2-Pit_lime_hand_relief.png-4f5f784ba7e998f94c40c7e70b269607.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "1493c571147fcafccb4754b97c33ad1f"
|
||||
@@ -14,11 +15,11 @@ generator_parameters={
|
||||
[deps]
|
||||
|
||||
source_file="res://src/map/dungeon/models/Area 2/Pit/A2-Pit_lime_hand_relief.png"
|
||||
dest_files=["res://.godot/imported/A2-Pit_lime_hand_relief.png-4f5f784ba7e998f94c40c7e70b269607.ctex"]
|
||||
dest_files=["res://.godot/imported/A2-Pit_lime_hand_relief.png-4f5f784ba7e998f94c40c7e70b269607.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
|
||||
@@ -254,7 +254,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.76788, -1.76654, -10.247)
|
||||
|
||||
[node name="Room" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.82181, 0)
|
||||
visible = false
|
||||
|
||||
[node name="Room" type="Area3D" parent="Room"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
Reference in New Issue
Block a user