using Godot; using System; using System.Collections.Generic; using System.Linq; public partial class PlayArea : Node2D { public Node2D _leftEdge, _rightEdge; public Area2D _region; public Map _map; public override void _Ready() { base._Ready(); _region = GetNode("Region"); _leftEdge = GetNode("LeftEdge"); _rightEdge = GetNode("RightEdge"); CollisionShape2D regionBounds = _region.GetNode("Bounds"); _map = GetNode("Map"); TileMapLayer occupiedSpaces = GetNode("OccupiedSpaces"); } public override void _Process(double delta) { base._Process(delta); } public void HighlightCells() { TileMapLayer occupiedSpaces = GetNode("OccupiedSpaces"); for (int i = 0; i < _map._cells.Count; i++) { MapCell c = _map._cells.ElementAt(i).Value; if (c._occupant != null) { GD.Print(c._occupant); occupiedSpaces.SetCell(c._address, 0, new Vector2I(4,0)); } else if (_map._astar.IsPointSolid(c._address)) { occupiedSpaces.SetCell(c._address, 0, new Vector2I(3,1)); } else { occupiedSpaces.SetCell(c._address, 0, new Vector2I(4,1)); } } } }