From d3dd190a6905ba2da3c4028b75cc8af97da9355c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 14 Nov 2023 21:35:29 -0600 Subject: [PATCH] shape --- src/engine/gameManager/ZoneManager.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/engine/gameManager/ZoneManager.java b/src/engine/gameManager/ZoneManager.java index d6a12650..8a3ed4d1 100644 --- a/src/engine/gameManager/ZoneManager.java +++ b/src/engine/gameManager/ZoneManager.java @@ -437,6 +437,21 @@ public enum ZoneManager { } public static void LinkNavNodes(){ - //TODO link nav nodes + //TODO optimize + for(Zone zone : getAllZones()){ + for(PathingUtilities.Node node : zone.navNodes){ + for(PathingUtilities.Node potentialNeighbor : zone.navNodes){ + try { + for (Path2D.Float obstacle : zone.navObstacles) { + if (!node.equals(potentialNeighbor) && !obstacle.intersects(node.location.x, node.location.y, potentialNeighbor.location.x, potentialNeighbor.location.y) && node.location.distance(potentialNeighbor.location) < 50) { + node.neighbors.add(potentialNeighbor); + } + } + } catch(Exception e){ + Logger.error("Failed To Check Neighbors Of Node In Zone: " + zone.getObjectUUID()); + } + } + } + } } }