mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-14 01:09:17 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
35 lines
978 B
C#
35 lines
978 B
C#
using Sandbox;
|
|
using Sandbox.Navigation;
|
|
|
|
internal class NavMeshLinkData : NavMeshSpatialAuxiliaryData
|
|
{
|
|
public Vector3 StartPosition;
|
|
public Vector3 EndPosition;
|
|
|
|
public bool IsBiDirectional = true;
|
|
|
|
public float ConnectionRadius;
|
|
|
|
// Used to associate this object with recast data
|
|
public object UserData = null;
|
|
|
|
public bool IsStartConnected = false;
|
|
|
|
public bool IsEndConnected = false;
|
|
|
|
public Vector3 StartPositionOnNavMesh;
|
|
|
|
public Vector3 EndPositionOnNavMesh;
|
|
|
|
protected override RectInt CalculateCurrentOverlappingTiles( NavMesh navMesh )
|
|
{
|
|
// Create a box that encompasses both start and end positions with radius
|
|
Vector3 min = Vector3.Min( StartPosition, EndPosition ) - new Vector3( ConnectionRadius );
|
|
Vector3 max = Vector3.Max( StartPosition, EndPosition ) + new Vector3( ConnectionRadius );
|
|
BBox linkBounds = new BBox( min, max );
|
|
|
|
// Get all tiles that this bounds overlaps
|
|
return navMesh.CalculateMinMaxTileCoords( linkBounds );
|
|
}
|
|
}
|