mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-21 20:08:40 +03:00
Added FindPath to C# API for path finding
This commit is contained in:
@@ -319,4 +319,28 @@ namespace Nuake.Net
|
||||
|
||||
public string Sprite { get; set; }
|
||||
}
|
||||
|
||||
public class NavMeshVolumeComponent : IComponent
|
||||
{
|
||||
internal static unsafe delegate*<int, float, float, float, float, float, float, NativeArray<float>> FindPathIcall;
|
||||
|
||||
public NavMeshVolumeComponent(int entityId) { EntityID = entityId; }
|
||||
|
||||
public List<Vector3> FindStraightPath(Vector3 start, Vector3 end)
|
||||
{
|
||||
List<Vector3> pathWaypoints = [];
|
||||
unsafe
|
||||
{
|
||||
NativeArray<float> waypoints = FindPathIcall(EntityID, start.X, start.Y, start.Z, end.X, end.Y, end.Z);
|
||||
for(int i = 0; i < waypoints.Length; i += 3)
|
||||
{
|
||||
Vector3 waypointPosition = new Vector3(waypoints[i], waypoints[i + 1], waypoints[i + 2]);
|
||||
pathWaypoints.Add(waypointPosition);
|
||||
}
|
||||
|
||||
return pathWaypoints;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ namespace Nuake.Net
|
||||
PARTICLE_EMITTER,
|
||||
QUAKE_MAP,
|
||||
BSP_BRUSH,
|
||||
SPRITE
|
||||
SPRITE,
|
||||
NAVMESH
|
||||
}
|
||||
|
||||
public int ID { get; set; }
|
||||
@@ -101,7 +102,8 @@ namespace Nuake.Net
|
||||
{ typeof(ParticleEmitterComponent), ComponentTypes.PARTICLE_EMITTER },
|
||||
{ typeof(QuakeMapComponent), ComponentTypes.QUAKE_MAP },
|
||||
{ typeof(BSPBrushComponent), ComponentTypes.BSP_BRUSH },
|
||||
{ typeof(SpriteComponent), ComponentTypes.SPRITE }
|
||||
{ typeof(SpriteComponent), ComponentTypes.SPRITE },
|
||||
{ typeof(NavMeshVolumeComponent), ComponentTypes.NAVMESH }
|
||||
};
|
||||
|
||||
public bool HasComponent<T>()
|
||||
|
||||
Reference in New Issue
Block a user