wip move to new uniffi language binding
This commit is contained in:
parent
f7a5d8f823
commit
53cbdd8440
30 changed files with 211 additions and 187 deletions
|
@ -10,22 +10,22 @@ internal sealed class EmptyTileFinder(
|
|||
var maxMinDistance = 0d;
|
||||
TilePosition spawnTile = default;
|
||||
for (ushort x = 1; x < MapService.TilesPerRow - 1; x++)
|
||||
for (ushort y = 1; y < MapService.TilesPerColumn - 1; y++)
|
||||
{
|
||||
var tile = new TilePosition(x, y);
|
||||
if (mapService.Current.IsWall(tile))
|
||||
continue;
|
||||
for (ushort y = 1; y < MapService.TilesPerColumn - 1; y++)
|
||||
{
|
||||
var tile = new TilePosition(x, y);
|
||||
if (mapService.Current.IsWall(tile))
|
||||
continue;
|
||||
|
||||
var tilePixelCenter = tile.GetCenter().ToFloatPosition();
|
||||
var minDistance = entityManager.AllEntities
|
||||
.Select(entity => entity.Position.Distance(tilePixelCenter))
|
||||
.Aggregate(double.MaxValue, Math.Min);
|
||||
if (minDistance <= maxMinDistance)
|
||||
continue;
|
||||
var tilePixelCenter = tile.GetCenter().ToFloatPosition();
|
||||
var minDistance = entityManager.AllEntities
|
||||
.Select(entity => entity.Position.Distance(tilePixelCenter))
|
||||
.Aggregate(double.MaxValue, Math.Min);
|
||||
if (minDistance <= maxMinDistance)
|
||||
continue;
|
||||
|
||||
maxMinDistance = minDistance;
|
||||
spawnTile = tile;
|
||||
}
|
||||
maxMinDistance = minDistance;
|
||||
spawnTile = tile;
|
||||
}
|
||||
|
||||
return spawnTile;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue