feat: add check for line of sight for range and skill attacks

This commit is contained in:
Иванов Иван
2024-08-18 17:32:29 +02:00
parent abadf90d4a
commit 5f19cc1f76
11 changed files with 50 additions and 34 deletions

View File

@@ -17,6 +17,9 @@ namespace Client.Infrastructure.Service
[DllImport("L2JGeoDataPathFinder.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern uint ReleasePath(IntPtr arrayPtr);
[DllImport("L2JGeoDataPathFinder.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern bool HasLineOfSight(string geoDataDirectory, float startX, float startY, float startZ, float endX, float endY, ushort maxPassableHeight);
public L2jGeoDataPathfinder(string geodataDirectory, ushort maxPassableHeight)
{
this.geodataDirectory = geodataDirectory;
@@ -48,6 +51,11 @@ namespace Client.Infrastructure.Service
return BuildPath(nodes);
}
public bool HasLineOfSight(Vector3 start, Vector3 end)
{
return HasLineOfSight(GetGeodataFullpath(), start.X, start.Y, start.Z, end.X, end.Y, maxPassableHeight);
}
private List<PathSegment> BuildPath(List<PathNode> nodes)
{
var result = new List<PathSegment>();