mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-07-05 17:21:17 +00:00
Starts of offshoots
This commit is contained in:
parent
210f96a829
commit
9331876637
2 changed files with 39 additions and 8 deletions
|
|
@ -96,6 +96,17 @@ public partial class RogueliteRoomManager : Node2D
|
||||||
_connections.Add(new RoomConnection(origin, currentPos + new Vector2I(0, 1)));
|
_connections.Add(new RoomConnection(origin, currentPos + new Vector2I(0, 1)));
|
||||||
Vector2I nextPos;
|
Vector2I nextPos;
|
||||||
|
|
||||||
|
var offshoots = new List<OffshootType>()
|
||||||
|
{
|
||||||
|
OffshootType.Item,
|
||||||
|
OffshootType.Secret,
|
||||||
|
OffshootType.Shop,
|
||||||
|
OffshootType.Key
|
||||||
|
};
|
||||||
|
var shuffledOffshoots = offshoots.Shuffle().ToList();
|
||||||
|
|
||||||
|
int currentOffshoot = 0;
|
||||||
|
|
||||||
for (int i = 0; i < DungeonLength; i++)
|
for (int i = 0; i < DungeonLength; i++)
|
||||||
{
|
{
|
||||||
nextPos = currentPos + new Vector2I(0, 1);
|
nextPos = currentPos + new Vector2I(0, 1);
|
||||||
|
|
@ -103,11 +114,7 @@ public partial class RogueliteRoomManager : Node2D
|
||||||
//var roomToSpawn = Rooms.Where(x => x.Type == RoomType.Regular).PickRandom();
|
//var roomToSpawn = Rooms.Where(x => x.Type == RoomType.Regular).PickRandom();
|
||||||
var roomToSpawn = randomRoomsList[i];
|
var roomToSpawn = randomRoomsList[i];
|
||||||
|
|
||||||
// First pick a random door on the from room
|
|
||||||
//var doorOffset = Math.Min(0, GD.RandRange(0, currentRoom.Size.X - 1));
|
|
||||||
|
|
||||||
// We're already in the new room position, we do not care about previous anymore
|
// We're already in the new room position, we do not care about previous anymore
|
||||||
|
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
|
|
||||||
// Place it at a random X position
|
// Place it at a random X position
|
||||||
|
|
@ -142,9 +149,24 @@ public partial class RogueliteRoomManager : Node2D
|
||||||
// nextPos is now the end of the room at the current exit
|
// nextPos is now the end of the room at the current exit
|
||||||
|
|
||||||
_connections.Add(new RoomConnection(nextPos, nextPos + new Vector2I(0, 1)));
|
_connections.Add(new RoomConnection(nextPos, nextPos + new Vector2I(0, 1)));
|
||||||
//+ new Vector2I(0, roomToSpawn.Size.Y -1)
|
|
||||||
// Reset X offset
|
// Spawn offshoot here
|
||||||
//nextPos = new Vector2I(0, nextPos.Y);
|
|
||||||
|
var offshootToSpawn = shuffledOffshoots[currentOffshoot % shuffledOffshoots.Count()];
|
||||||
|
|
||||||
|
int roomsInOffshot = GD.RandRange(0, MaxBranchLength);
|
||||||
|
|
||||||
|
for (int j = 0; j < roomsInOffshot; j++)
|
||||||
|
{
|
||||||
|
// Get a random door on right or left side
|
||||||
|
// spawn
|
||||||
|
// Add path
|
||||||
|
// Move cursor
|
||||||
|
// if last room generate final room
|
||||||
|
// Continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offshoot over
|
||||||
|
|
||||||
currentPos = nextPos;
|
currentPos = nextPos;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
Scripts/Enums/OffshootType.cs
Normal file
9
Scripts/Enums/OffshootType.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Cirno.Scripts.Enums;
|
||||||
|
|
||||||
|
public enum OffshootType
|
||||||
|
{
|
||||||
|
Item,
|
||||||
|
Key,
|
||||||
|
Secret,
|
||||||
|
Shop
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue