cirnogodot/Scripts/Controllers/DoorMarker.cs
2025-04-11 18:39:39 +02:00

38 lines
No EOL
1,004 B
C#

using Godot;
namespace Cirno.Scripts.Controllers;
// [Tool]
public partial class DoorMarker : Marker2D
{
[Export] public RoomDirection Direction { get; set; } = RoomDirection.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),
_ => Vector2I.Zero
};
}
// public override void _Draw()
// {
// if (!Engine.IsEditorHint()) return;
//
// DrawLine(Vector2.Zero, Vector2.Up * 16, Colors.Orange, 2);
// DrawString(GetFont("font", "Label"), new Vector2(10, -10), Direction.ToString(), HAlign.Left);
// }
}
public enum RoomDirection
{
North,
South,
East,
West
}