Automatic doors

This commit is contained in:
Marco 2025-04-23 13:38:54 +02:00
commit 3fc39f63c4
29 changed files with 401 additions and 525 deletions

View file

@ -1,21 +1,22 @@
using Godot;
using Cirno.Scripts.Enums;
using Godot;
namespace Cirno.Scripts.Controllers;
// [Tool]
[Tool]
public partial class DoorMarker : Marker2D
{
[Export] public RoomDirection Direction { get; set; } = RoomDirection.North;
[Export] public DoorDirections Direction { get; set; } = DoorDirections.North;
[Export] public int WallIndex { get; set; } = 0; // Useful if there are multiple along a wall
public Vector2I GetWorldDirection()
{
return Direction switch
{
RoomDirection.North => new Vector2I(0, -1),
RoomDirection.South => new Vector2I(0, 1),
RoomDirection.East => new Vector2I(1, 0),
RoomDirection.West => new Vector2I(-1, 0),
DoorDirections.North => new Vector2I(0, -1),
DoorDirections.South => new Vector2I(0, 1),
DoorDirections.East => new Vector2I(1, 0),
DoorDirections.West => new Vector2I(-1, 0),
_ => Vector2I.Zero
};
}
@ -28,11 +29,3 @@ public partial class DoorMarker : Marker2D
// DrawString(GetFont("font", "Label"), new Vector2(10, -10), Direction.ToString(), HAlign.Left);
// }
}
public enum RoomDirection
{
North,
South,
East,
West
}