cirnogodot/Scripts/Resources/Roguelite/RogueliteRoomResource.cs

40 lines
1.1 KiB
C#
Raw Normal View History

2025-04-22 13:50:26 +02:00
using System.Collections.Generic;
using Cirno.Scripts.Enums;
2025-04-11 18:39:39 +02:00
using Godot;
2025-04-11 15:53:59 +02:00
using Godot.Collections;
2025-04-10 19:04:06 +02:00
namespace Cirno.Scripts.Resources.Roguelite;
[GlobalClass]
public partial class RogueliteRoomResource : Resource
{
[Export] public StringName RoomName { get; set; }
2025-04-11 18:39:39 +02:00
[Export] public RoomType Type { get; set; } = RoomType.Regular;
2025-04-10 19:04:06 +02:00
[Export] public StringName ScenePath { get; set; }
2025-04-11 18:39:39 +02:00
[Export] public Vector2I Size { get; set; } = new(1, 1);
[Export] public Array<Vector2I> DoorGridPositions { get; set; } = [];
2025-04-11 15:53:59 +02:00
[Export] public Array<EnemyResource> SpawnableEnemies { get; set; }
2025-04-20 17:47:57 +02:00
[Export] public DoorDirections DoorDirections { get; set; }
public bool HasDoors(DoorDirections required) => (DoorDirections & required) == required;
2025-04-21 17:46:26 +02:00
public override string ToString()
{
return $"{RoomName} {Type} {Size.X}x{Size.Y}";
}
2025-04-22 13:50:26 +02:00
public List<Vector2I> GetTopRoomOffsets(Vector2I gridPosition)
{
List<Vector2I> offsets = [];
for (int i = 0; i < Size.X; i++)
{
offsets.Add(new Vector2I(gridPosition.X - i, gridPosition.Y));
}
return offsets;
}
2025-04-10 19:04:06 +02:00
}