Added more symbols to the game, added gates blocking pathfinding and improved DSL feedback system with enum for better control and UX
This commit is contained in:
@@ -8,6 +8,7 @@ public class Pathfinding
|
||||
private static Dictionary<Vector3I, long> coordToId = new();
|
||||
private static Dictionary<long, Vector3I> idToCoord = new();
|
||||
private static long nextId = 1;
|
||||
private static long[] layerGateIds = new long[GameData.ruinSize];
|
||||
|
||||
private static long GetOrCreateId(Vector3I coord)
|
||||
{
|
||||
@@ -26,6 +27,7 @@ public class Pathfinding
|
||||
aStar.Clear();
|
||||
coordToId.Clear();
|
||||
idToCoord.Clear();
|
||||
layerGateIds = new long[GameData.ruinSize];
|
||||
nextId = 1;
|
||||
|
||||
for (int y = 0; y < GameData.ruinSize; y++)
|
||||
@@ -43,6 +45,10 @@ public class Pathfinding
|
||||
long id = GetOrCreateId(coord);
|
||||
|
||||
aStar.AddPoint(id, tile.Position);
|
||||
if (tile.collapsedMesh == "gate")
|
||||
{
|
||||
layerGateIds[y] = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,6 +80,16 @@ public class Pathfinding
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < GameData.ruinSize; y++)
|
||||
{
|
||||
UpdateGatePoint(y, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateGatePoint(int layer, bool isOpen)
|
||||
{
|
||||
aStar.SetPointDisabled(layerGateIds[layer], !isOpen);
|
||||
}
|
||||
|
||||
public static List<Vector3> GetPath(Vector3I start, Vector3I end)
|
||||
|
||||
Reference in New Issue
Block a user