cirnogodot/Scripts/Controllers/DoorMarker.cs

31 lines
963 B
C#
Raw Normal View History

2025-04-23 13:38:54 +02:00
using Cirno.Scripts.Enums;
using Godot;
2025-04-11 18:39:39 +02:00
namespace Cirno.Scripts.Controllers;
2025-04-23 13:38:54 +02:00
[Tool]
2025-04-11 18:39:39 +02:00
public partial class DoorMarker : Marker2D
{
2025-04-23 13:38:54 +02:00
[Export] public DoorDirections Direction { get; set; } = DoorDirections.North;
2025-04-11 18:39:39 +02:00
[Export] public int WallIndex { get; set; } = 0; // Useful if there are multiple along a wall
public Vector2I GetWorldDirection()
{
return Direction switch
{
2025-04-23 13:38:54 +02:00
DoorDirections.North => new Vector2I(0, -1),
DoorDirections.South => new Vector2I(0, 1),
DoorDirections.East => new Vector2I(1, 0),
DoorDirections.West => new Vector2I(-1, 0),
2025-04-11 18:39:39 +02:00
_ => 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);
// }
}