public unsafe PathQueryStatus BeginFindPath(NavMeshLocation start, NavMeshLocation end, int areaMask = NavMesh.AllAreas, NativeArray <float> costs = new NativeArray <float>()) { void *costsPtr = costs.Length > 0 ? costs.GetUnsafePtr() : null; return(BeginFindPath(m_NavMeshQuery, start, end, areaMask, costsPtr)); }
private static NavMeshLocation MoveLocation(IntPtr navMeshQuery, NavMeshLocation location, Vector3 target, int areaMask) { NavMeshLocation result; NavMeshQuery.MoveLocation_Injected(navMeshQuery, ref location, ref target, areaMask, out result); return(result); }
public unsafe PathQueryStatus BeginFindPath(NavMeshLocation start, NavMeshLocation end, int areaMask = NavMesh.AllAreas, NativeArray <float> costs = new NativeArray <float>()) { AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); if (!HasNodePool(m_NavMeshQuery)) { throw new InvalidOperationException(k_NoBufferAllocatedErrorMessage); } const int kAreaCount = 32; if (costs.Length != 0) { if (costs.Length != kAreaCount) { throw new ArgumentException( string.Format("The number of costs ({0}) must be exactly {1}, one for each possible area type.", costs.Length, kAreaCount) , "costs"); } for (var i = 0; i < costs.Length; i++) { if (costs[i] < 1.0f) { throw new ArgumentException( string.Format("The area cost ({0}) at index ({1}) must be greater or equal to 1.", costs[i], i), "costs"); } } } var agentTypeStart = GetAgentTypeIdForPolygon(start.polygon); if (agentTypeStart < 0) { throw new ArgumentException("The start location doesn't belong to any active NavMesh surface.", "start"); } var agentTypeEnd = GetAgentTypeIdForPolygon(end.polygon); if (agentTypeEnd < 0) { throw new ArgumentException("The end location doesn't belong to any active NavMesh surface.", "end"); } if (agentTypeStart != agentTypeEnd) { throw new ArgumentException(string.Format( "The start and end locations belong to different NavMesh surfaces, with agent type IDs {0} and {1}.", agentTypeStart, agentTypeEnd)); } void *costsPtr = costs.Length > 0 ? costs.GetUnsafePtr() : null; return(BeginFindPath(m_NavMeshQuery, start, end, areaMask, costsPtr)); }
public unsafe PathQueryStatus BeginFindPath(NavMeshLocation start, NavMeshLocation end, int areaMask = -1, NativeArray <float> costs = default(NativeArray <float>)) { AtomicSafetyHandle.CheckWriteAndThrow(this.m_Safety); bool flag = !NavMeshQuery.HasNodePool(this.m_NavMeshQuery); if (flag) { throw new InvalidOperationException("This query has no buffer allocated for pathfinding operations. Create a different NavMeshQuery with an explicit node pool size."); } bool flag2 = costs.Length != 0; if (flag2) { bool flag3 = costs.Length != 32; if (flag3) { throw new ArgumentException(string.Format("The number of costs ({0}) must be exactly {1}, one for each possible area type.", costs.Length, 32), "costs"); } for (int i = 0; i < costs.Length; i++) { bool flag4 = costs[i] < 1f; if (flag4) { throw new ArgumentException(string.Format("The area cost ({0}) at index ({1}) must be greater or equal to 1.", costs[i], i), "costs"); } } } bool flag5 = !this.IsValid(start.polygon); if (flag5) { throw new ArgumentException("The start location doesn't belong to any active NavMesh surface.", "start"); } bool flag6 = !this.IsValid(end.polygon); if (flag6) { throw new ArgumentException("The end location doesn't belong to any active NavMesh surface.", "end"); } int agentTypeIdForPolygon = this.GetAgentTypeIdForPolygon(start.polygon); int agentTypeIdForPolygon2 = this.GetAgentTypeIdForPolygon(end.polygon); bool flag7 = agentTypeIdForPolygon != agentTypeIdForPolygon2; if (flag7) { throw new ArgumentException(string.Format("The start and end locations belong to different NavMesh surfaces, with agent type IDs {0} and {1}.", agentTypeIdForPolygon, agentTypeIdForPolygon2)); } void *costs2 = (costs.Length > 0) ? costs.GetUnsafePtr <float>() : null; return(NavMeshQuery.BeginFindPath(this.m_NavMeshQuery, start, end, areaMask, costs2)); }
public unsafe PathQueryStatus Raycast(out NavMeshHit hit, NavMeshLocation start, Vector3 targetPosition, int areaMask = -1, NativeArray <float> costs = default(NativeArray <float>)) { AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety); bool flag = costs.Length != 0; if (flag) { bool flag2 = costs.Length != 32; if (flag2) { throw new ArgumentException(string.Format("The number of costs ({0}) must be exactly {1}, one for each possible area type.", costs.Length, 32), "costs"); } } void * costs2 = (costs.Length == 32) ? costs.GetUnsafePtr <float>() : null; int num; PathQueryStatus pathQueryStatus = NavMeshQuery.Raycast(this.m_NavMeshQuery, start, targetPosition, areaMask, costs2, out hit, null, out num, 0); return(pathQueryStatus & ~PathQueryStatus.BufferTooSmall); }
public unsafe PathQueryStatus Raycast(out NavMeshHit hit, NavMeshLocation start, Vector3 targetPosition, int areaMask = NavMesh.AllAreas, NativeArray <float> costs = new NativeArray <float>()) { const int kAreaCount = 32; AtomicSafetyHandle.CheckReadAndThrow(m_Safety); if (costs.Length != 0) { if (costs.Length != kAreaCount) { throw new ArgumentException( string.Format("The number of costs ({0}) must be exactly {1}, one for each possible area type.", costs.Length, kAreaCount), "costs"); } } int pathCount; var costsPtr = costs.Length == kAreaCount?costs.GetUnsafePtr() : null; var status = Raycast(m_NavMeshQuery, start, targetPosition, areaMask, costsPtr, out hit, null, out pathCount, 0); status &= ~PathQueryStatus.BufferTooSmall; return(status); }
public NavMeshLocation MoveLocation(NavMeshLocation location, Vector3 target, int areaMask = -1) { AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety); return(NavMeshQuery.MoveLocation(this.m_NavMeshQuery, location, target, areaMask)); }
private static extern void MoveLocation_Injected(IntPtr navMeshQuery, ref NavMeshLocation location, ref Vector3 target, int areaMask, out NavMeshLocation ret);
private unsafe static extern PathQueryStatus Raycast_Injected(IntPtr navMeshQuery, ref NavMeshLocation start, ref Vector3 targetPosition, int areaMask, void *costs, out NavMeshHit hit, void *path, out int pathCount, int maxPath);
private unsafe static extern PathQueryStatus BeginFindPath_Injected(IntPtr navMeshQuery, ref NavMeshLocation start, ref NavMeshLocation end, int areaMask, void *costs);
private static extern void MapLocation_Injected(IntPtr navMeshQuery, ref Vector3 position, ref Vector3 extents, int agentTypeID, int areaMask = -1, out NavMeshLocation ret);
unsafe static extern PathQueryStatus BeginFindPath(IntPtr navMeshQuery, NavMeshLocation start, NavMeshLocation end, int areaMask, void *costs);
public unsafe PathQueryStatus Raycast(out NavMeshHit hit, NativeSlice <PolygonId> path, out int pathCount, NavMeshLocation start, Vector3 targetPosition, int areaMask = -1, NativeArray <float> costs = default(NativeArray <float>)) { AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety); bool flag = costs.Length != 0; if (flag) { bool flag2 = costs.Length != 32; if (flag2) { throw new ArgumentException(string.Format("The number of costs ({0}) must be exactly {1}, one for each possible area type.", costs.Length, 32), "costs"); } } void *costs2 = (costs.Length == 32) ? costs.GetUnsafePtr <float>() : null; void *ptr = (path.Length > 0) ? path.GetUnsafePtr <PolygonId>() : null; int maxPath = (ptr != null) ? path.Length : 0; return(NavMeshQuery.Raycast(this.m_NavMeshQuery, start, targetPosition, areaMask, costs2, out hit, ptr, out pathCount, maxPath)); }
static extern unsafe PathQueryStatus Raycast(IntPtr navMeshQuery, NavMeshLocation start, Vector3 targetPosition, int areaMask, void *costs, out NavMeshHit hit, void *path, out int pathCount, int maxPath);
private unsafe static PathQueryStatus Raycast(IntPtr navMeshQuery, NavMeshLocation start, Vector3 targetPosition, int areaMask, void *costs, out NavMeshHit hit, void *path, out int pathCount, int maxPath) { return(NavMeshQuery.Raycast_Injected(navMeshQuery, ref start, ref targetPosition, areaMask, costs, out hit, path, out pathCount, maxPath)); }
public NavMeshLocation MoveLocation(NavMeshLocation location, Vector3 target, int areaMask = NavMesh.AllAreas) { AtomicSafetyHandle.CheckReadAndThrow(m_Safety); return(MoveLocation(m_NavMeshQuery, location, target, areaMask)); }
public bool IsValid(NavMeshLocation location) { return(this.IsValid(location.polygon)); }
private unsafe static PathQueryStatus BeginFindPath(IntPtr navMeshQuery, NavMeshLocation start, NavMeshLocation end, int areaMask, void *costs) { return(NavMeshQuery.BeginFindPath_Injected(navMeshQuery, ref start, ref end, areaMask, costs)); }
public NavMeshLocation MoveLocation(NavMeshLocation location, Vector3 target, int areaMask = NavMesh.AllAreas) { return(MoveLocation(m_NavMeshQuery, location, target, areaMask)); }
static extern NavMeshLocation MoveLocation(IntPtr navMeshQuery, NavMeshLocation location, Vector3 target, int areaMask);