Teleport enemy to random room item
This commit is contained in:
@@ -10,6 +10,8 @@ public interface IMap : INode3D
|
||||
{
|
||||
public Godot.Collections.Array<PackedScene> Floors { get; }
|
||||
|
||||
public IDungeonFloor CurrentFloor { get; }
|
||||
|
||||
public void SpawnNextFloor();
|
||||
|
||||
public Transform3D GetPlayerSpawnPosition();
|
||||
@@ -27,7 +29,7 @@ public partial class Map : Node3D, IMap
|
||||
[Export]
|
||||
public Godot.Collections.Array<PackedScene> Floors { get; set; } = default!;
|
||||
|
||||
private IDungeonFloor _currentFloor;
|
||||
public IDungeonFloor CurrentFloor { get; private set; }
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
@@ -36,14 +38,14 @@ public partial class Map : Node3D, IMap
|
||||
|
||||
public void SpawnNextFloor()
|
||||
{
|
||||
var oldFloor = _currentFloor;
|
||||
var oldFloor = CurrentFloor;
|
||||
oldFloor.CallDeferred(MethodName.QueueFree, []);
|
||||
LoadFloor();
|
||||
_currentFloor.InitializeDungeon();
|
||||
CurrentFloor.InitializeDungeon();
|
||||
Game.NextFloorLoaded();
|
||||
}
|
||||
|
||||
public Transform3D GetPlayerSpawnPosition() => _currentFloor.GetPlayerSpawnPoint();
|
||||
public Transform3D GetPlayerSpawnPosition() => CurrentFloor.GetPlayerSpawnPoint();
|
||||
|
||||
private void LoadFloor()
|
||||
{
|
||||
@@ -51,7 +53,7 @@ public partial class Map : Node3D, IMap
|
||||
var instantiator = new Instantiator(GetTree());
|
||||
var loadedScene = instantiator.LoadAndInstantiate<Node3D>(currentFloorScene.ResourcePath);
|
||||
AddChild(loadedScene);
|
||||
_currentFloor = (IDungeonFloor)loadedScene;
|
||||
CurrentFloor = (IDungeonFloor)loadedScene;
|
||||
Floors.Remove(currentFloorScene);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
|
||||
@@ -11,6 +12,8 @@ public partial class BossFloor : Node3D, IDungeonFloor
|
||||
|
||||
private BossRoomA BossRoom;
|
||||
|
||||
public ImmutableList<MonsterRoom> Rooms => [];
|
||||
|
||||
public void InitializeDungeon()
|
||||
{
|
||||
var bossRoomScene = GD.Load<PackedScene>($"res://src/map/dungeon/scenes/BossRoom.tscn");
|
||||
|
||||
@@ -2,6 +2,7 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
|
||||
namespace GameJamDungeon
|
||||
@@ -17,7 +18,7 @@ namespace GameJamDungeon
|
||||
|
||||
private Transform3D _playerSpawnPoint;
|
||||
|
||||
internal List<MonsterRoom> Rooms { get; private set; }
|
||||
public ImmutableList<MonsterRoom> Rooms { get; private set; }
|
||||
|
||||
public void InitializeDungeon()
|
||||
{
|
||||
@@ -43,7 +44,7 @@ namespace GameJamDungeon
|
||||
return result.GlobalTransform;
|
||||
}
|
||||
|
||||
private static List<MonsterRoom> FindAllDungeonRooms(List<Node> nodesToSearch, List<MonsterRoom> roomsFound)
|
||||
private static ImmutableList<MonsterRoom> FindAllDungeonRooms(List<Node> nodesToSearch, ImmutableList<MonsterRoom> roomsFound)
|
||||
{
|
||||
if (nodesToSearch.Count == 0)
|
||||
return roomsFound;
|
||||
@@ -51,7 +52,7 @@ namespace GameJamDungeon
|
||||
foreach (var node in nodesToSearch)
|
||||
{
|
||||
if (node is MonsterRoom dungeonRoom)
|
||||
roomsFound.Add(dungeonRoom);
|
||||
roomsFound = roomsFound.Add(dungeonRoom);
|
||||
|
||||
if (node.HasSignal("dungeon_done_generating"))
|
||||
node.EmitSignal("dungeon_done_generating");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
|
||||
@@ -15,6 +16,8 @@ public partial class Floor0 : Node3D, IDungeonFloor, IExitRoom
|
||||
|
||||
[Node] private Marker3D PlayerSpawnPoint { get; set; } = default!;
|
||||
|
||||
public ImmutableList<MonsterRoom> Rooms => [];
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
Show();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Godot;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
public interface IDungeonFloor : INode3D
|
||||
@@ -7,4 +8,6 @@ public interface IDungeonFloor : INode3D
|
||||
void InitializeDungeon();
|
||||
|
||||
public Transform3D GetPlayerSpawnPoint();
|
||||
|
||||
public ImmutableList<MonsterRoom> Rooms { get; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -12,6 +13,8 @@ public partial class Overworld : Node3D, IDungeonFloor
|
||||
|
||||
[Node] public Marker3D ExitSpawnPoint { get; set; } = default!;
|
||||
|
||||
public ImmutableList<MonsterRoom> Rooms => [];
|
||||
|
||||
public void InitializeDungeon()
|
||||
{
|
||||
Show();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://4k6vtn4oip5f" path="res://src/map/dungeon/models/Set A/02. Altar/02_ALTAR_FLOOR_ZER0_VER_TILE4.png" id="14_qqc7i"]
|
||||
[ext_resource type="Texture2D" uid="uid://cururtxtgylxf" path="res://src/map/dungeon/models/Set A/02. Altar/02_ALTAR_FLOOR_ZER0_VER_COLUMN.jpg" id="15_ojbcg"]
|
||||
[ext_resource type="PackedScene" uid="uid://1fl6s352e2ej" path="res://src/items/throwable/ThrowableItem.tscn" id="16_db2o3"]
|
||||
[ext_resource type="Resource" uid="uid://bph8c6by4s047" path="res://src/items/throwable/resources/GeomanticDice.tres" id="17_ntxe5"]
|
||||
[ext_resource type="Resource" uid="uid://lo37qfyxlhx1" path="res://src/items/throwable/resources/Gospel of Dimension.tres" id="17_db2o3"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3ubi4"]
|
||||
shading_mode = 0
|
||||
@@ -856,7 +856,7 @@ shape = SubResource("BoxShape3D_xh2ej")
|
||||
|
||||
[node name="ThrowableItem" parent="." instance=ExtResource("16_db2o3")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.469, -2.5, 0)
|
||||
_throwableItemStats = ExtResource("17_ntxe5")
|
||||
_throwableItemStats = ExtResource("17_db2o3")
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.22379, 0)
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://bc1sp6xwe0j65"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bc1sp6xwe0j65"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dwt6302nsf4vq" path="res://src/map/dungeon/code/DungeonFloor.cs" id="1_0ecnn"]
|
||||
[ext_resource type="Script" uid="uid://b1x125h0tya2w" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="2_cxmwa"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpec2lbt83dhe" path="res://src/map/dungeon/rooms/Set A/03. Antechamber A.tscn" id="3_gkkr3"]
|
||||
[ext_resource type="PackedScene" uid="uid://b82dx66mgs2d7" path="res://src/map/dungeon/rooms/Set A/08. Basin Room.tscn" id="8_5rblf"]
|
||||
[ext_resource type="PackedScene" uid="uid://cmvimr0pvsgqy" path="res://src/enemy/enemy_types/10. Eden Pillar/Eden Pillar.tscn" id="10_atq1f"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="11_sdyti"]
|
||||
[ext_resource type="PackedScene" uid="uid://c6tqt27ql8s35" path="res://src/enemy/enemy_types/07. chinthe/Chinthe.tscn" id="12_1l8yt"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="12_aw26s"]
|
||||
[ext_resource type="PackedScene" uid="uid://cihbmyo0ltq4m" path="res://src/map/dungeon/rooms/Set A/19. Floor Exit A.tscn" id="12_n02rw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bksq62muhk3h5" path="res://src/enemy/enemy_types/01. sproingy/Sproingy.tscn" id="13_kwaga"]
|
||||
@@ -175,16 +172,3 @@ shape = SubResource("BoxShape3D_xw4dv")
|
||||
[node name="EnemyDatabase" parent="." instance=ExtResource("12_aw26s")]
|
||||
unique_name_in_owner = true
|
||||
EnemyList = Array[PackedScene]([ExtResource("13_kwaga"), ExtResource("14_gkkr3")])
|
||||
|
||||
[node name="Eden Pillar" parent="." instance=ExtResource("10_atq1f")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -29.7976, -1.33866, 30.3232)
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("11_sdyti")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.07588, -1.71359, 12.7507)
|
||||
|
||||
[node name="Chinthe" parent="." instance=ExtResource("12_1l8yt")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.2934, -0.81355, 21.6535)
|
||||
PrimaryAttackElementalType = 0
|
||||
PrimaryAttackElementalDamageBonus = 1.0
|
||||
_movementSpeed = 2.0
|
||||
|
||||
Reference in New Issue
Block a user