cirnogodot/Scripts/TilemapAvoidance.cs
2025-01-31 15:05:45 +01:00

34 lines
668 B
C#

using Godot;
using System;
public partial class TilemapAvoidance : TileMapLayer
{
[Export] private TileMapLayer _solidLayer;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public override bool _UseTileDataRuntimeUpdate(Vector2I coords)
{
if (_solidLayer.GetUsedCellsById(0).Contains(coords))
{
return true;
}
return false;
}
public override void _TileDataRuntimeUpdate(Vector2I coords, TileData tileData)
{
tileData.SetNavigationPolygon(0, null);
}
}