mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 02:45:55 +00:00
Dungeon generation
This commit is contained in:
parent
4d2b58e234
commit
c3107fbce9
9 changed files with 494 additions and 130 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cirno.Scripts.Components.FSM.Enemy;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Resources.Roguelite;
|
||||
using Godot;
|
||||
|
|
@ -22,6 +23,19 @@ public partial class RogueliteRoom : Node2D
|
|||
return BottomLeft + new Vector2I(GD.RandRange(0, RoomResource.Size.X - 1), 0);
|
||||
}
|
||||
|
||||
public Vector2I RandomExit(Direction direction)
|
||||
{
|
||||
return direction switch
|
||||
{
|
||||
Direction.Up => GridPosition + new Vector2I(GD.RandRange(0, RoomResource.Size.X - 1), 0),
|
||||
Direction.Down => BottomLeft + new Vector2I(GD.RandRange(0, RoomResource.Size.X - 1), 0),
|
||||
Direction.Left => GridPosition + new Vector2I(0, GD.RandRange(0, RoomResource.Size.Y - 1)),
|
||||
Direction.Right => GridPosition + new Vector2I(RoomResource.Size.X - 1, 0) +
|
||||
new Vector2I(0, GD.RandRange(0, RoomResource.Size.Y - 1)),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(direction), direction, null)
|
||||
};
|
||||
}
|
||||
|
||||
[Export] public PackedScene DoorPrefab { get; private set; }
|
||||
[Export] public PackedScene WallPrefab { get; private set; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue