using Godot; using System; public partial class DungeonLevel : Node2D { private TileMapLayer buildingLayer; public Godot.Collections.Array Actors { get; private set; } = []; private Node2D actorsNode; public override void _Ready() { base._Ready(); buildingLayer = GetNode("Dungeon"); actorsNode = GetNode("Actors"); } public void InsertActor(Actor actor) { Actors.Add(actor); actorsNode.AddChild(actor); } public bool IsTileWalkable(Vector2I pos) { TileData tile = buildingLayer.GetCellTileData(pos); if (tile == null) return false; return (bool)tile.GetCustomData("isWalkable"); } public Actor GetBlockingActorAtPosition(Vector2I pos) { foreach (Actor actor in Actors) { if (actor.GridPosition == pos && actor.BlocksMovement) { return actor; } } return null; } }