mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Starts of offshoots
This commit is contained in:
parent
210f96a829
commit
9331876637
2 changed files with 39 additions and 8 deletions
|
|
@ -96,18 +96,25 @@ public partial class RogueliteRoomManager : Node2D
|
|||
_connections.Add(new RoomConnection(origin, currentPos + new Vector2I(0, 1)));
|
||||
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++)
|
||||
{
|
||||
nextPos = currentPos + new Vector2I(0, 1);
|
||||
|
||||
//var roomToSpawn = Rooms.Where(x => x.Type == RoomType.Regular).PickRandom();
|
||||
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
|
||||
|
||||
var offset = 0;
|
||||
|
||||
// Place it at a random X position
|
||||
|
|
@ -142,10 +149,25 @@ public partial class RogueliteRoomManager : Node2D
|
|||
// nextPos is now the end of the room at the current exit
|
||||
|
||||
_connections.Add(new RoomConnection(nextPos, nextPos + new Vector2I(0, 1)));
|
||||
//+ new Vector2I(0, roomToSpawn.Size.Y -1)
|
||||
// Reset X offset
|
||||
//nextPos = new Vector2I(0, nextPos.Y);
|
||||
|
||||
// Spawn offshoot here
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue