forked from bit/DotRecastNetSim
remove Detour.QueryResults.Result
This commit is contained in:
parent
0d7cbb5502
commit
1d7c329f23
|
@ -25,7 +25,7 @@ using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.Crowd.Tracking;
|
using DotRecast.Detour.Crowd.Tracking;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour.Crowd
|
namespace DotRecast.Detour.Crowd
|
||||||
{
|
{
|
||||||
|
@ -560,6 +560,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
RcSortedQueue<DtCrowdAgent> queue = new RcSortedQueue<DtCrowdAgent>((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime));
|
RcSortedQueue<DtCrowdAgent> queue = new RcSortedQueue<DtCrowdAgent>((a1, a2) => a2.targetReplanTime.CompareTo(a1.targetReplanTime));
|
||||||
|
|
||||||
// Fire off new requests.
|
// Fire off new requests.
|
||||||
|
List<long> reqPath = new List<long>();
|
||||||
foreach (DtCrowdAgent ag in agents)
|
foreach (DtCrowdAgent ag in agents)
|
||||||
{
|
{
|
||||||
if (ag.state == CrowdAgentState.DT_CROWDAGENT_STATE_INVALID)
|
if (ag.state == CrowdAgentState.DT_CROWDAGENT_STATE_INVALID)
|
||||||
|
@ -581,26 +582,26 @@ namespace DotRecast.Detour.Crowd
|
||||||
throw new ArgumentException("Empty path");
|
throw new ArgumentException("Empty path");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Quick search towards the goal.
|
// Quick search towards the goal.
|
||||||
_navQuery.InitSlicedFindPath(path[0], ag.targetRef, ag.npos, ag.targetPos,
|
_navQuery.InitSlicedFindPath(path[0], ag.targetRef, ag.npos, ag.targetPos,
|
||||||
_filters[ag.option.queryFilterType], 0);
|
_filters[ag.option.queryFilterType], 0);
|
||||||
_navQuery.UpdateSlicedFindPath(_config.maxTargetFindPathIterations, out var _);
|
_navQuery.UpdateSlicedFindPath(_config.maxTargetFindPathIterations, out var _);
|
||||||
Result<List<long>> pathFound;
|
|
||||||
|
DtStatus status;
|
||||||
if (ag.targetReplan) // && npath > 10)
|
if (ag.targetReplan) // && npath > 10)
|
||||||
{
|
{
|
||||||
// Try to use existing steady path during replan if
|
// Try to use existing steady path during replan if possible.
|
||||||
// possible.
|
status = _navQuery.FinalizeSlicedFindPathPartial(path, ref reqPath);
|
||||||
pathFound = _navQuery.FinalizeSlicedFindPathPartial(path);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Try to move towards target when goal changes.
|
// Try to move towards target when goal changes.
|
||||||
pathFound = _navQuery.FinalizeSlicedFindPath();
|
status = _navQuery.FinalizeSlicedFindPath(ref reqPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<long> reqPath = pathFound.result;
|
|
||||||
RcVec3f reqPos = new RcVec3f();
|
RcVec3f reqPos = new RcVec3f();
|
||||||
if (pathFound.Succeeded() && reqPath.Count > 0)
|
if (status.Succeeded() && reqPath.Count > 0)
|
||||||
{
|
{
|
||||||
// In progress or succeed.
|
// In progress or succeed.
|
||||||
if (reqPath[reqPath.Count - 1] != ag.targetRef)
|
if (reqPath[reqPath.Count - 1] != ag.targetRef)
|
||||||
|
|
|
@ -21,7 +21,7 @@ freely, subject to the following restrictions:
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour.Crowd
|
namespace DotRecast.Detour.Crowd
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ freely, subject to the following restrictions:
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour.Crowd
|
namespace DotRecast.Detour.Crowd
|
||||||
{
|
{
|
||||||
|
@ -349,13 +349,14 @@ namespace DotRecast.Detour.Crowd
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var res = new List<long>();
|
||||||
navquery.InitSlicedFindPath(m_path[0], m_path[m_path.Count - 1], m_pos, m_target, filter, 0);
|
navquery.InitSlicedFindPath(m_path[0], m_path[m_path.Count - 1], m_pos, m_target, filter, 0);
|
||||||
navquery.UpdateSlicedFindPath(maxIterations, out var _);
|
navquery.UpdateSlicedFindPath(maxIterations, out var _);
|
||||||
Result<List<long>> fpr = navquery.FinalizeSlicedFindPathPartial(m_path);
|
var status = navquery.FinalizeSlicedFindPathPartial(m_path, ref res);
|
||||||
|
|
||||||
if (fpr.Succeeded() && fpr.result.Count > 0)
|
if (status.Succeeded() && res.Count > 0)
|
||||||
{
|
{
|
||||||
m_path = MergeCorridorStartShortcut(m_path, fpr.result);
|
m_path = MergeCorridorStartShortcut(m_path, res);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour.Crowd
|
namespace DotRecast.Detour.Crowd
|
||||||
{
|
{
|
||||||
|
@ -65,9 +65,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
|
|
||||||
if (q.result.status.Succeeded())
|
if (q.result.status.Succeeded())
|
||||||
{
|
{
|
||||||
Result<List<long>> path = q.navQuery.FinalizeSlicedFindPath();
|
q.result.status = q.navQuery.FinalizeSlicedFindPath(ref q.result.path);
|
||||||
q.result.status = path.status;
|
|
||||||
q.result.path = path.result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(q.result.status.Failed() || q.result.status.Succeeded()))
|
if (!(q.result.status.Failed() || q.result.status.Succeeded()))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using DotRecast.Recast;
|
using DotRecast.Recast;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Jumplink
|
namespace DotRecast.Detour.Extras.Jumplink
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour
|
namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour
|
namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour
|
namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
|
@ -1333,14 +1332,18 @@ namespace DotRecast.Detour
|
||||||
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
|
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
|
||||||
/// [(polyRef) * @p pathCount]
|
/// [(polyRef) * @p pathCount]
|
||||||
/// @returns The status flags for the query.
|
/// @returns The status flags for the query.
|
||||||
public virtual Result<List<long>> FinalizeSlicedFindPath()
|
public virtual DtStatus FinalizeSlicedFindPath(ref List<long> path)
|
||||||
{
|
{
|
||||||
List<long> path = new List<long>(64);
|
if (null == path)
|
||||||
|
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||||
|
|
||||||
|
path.Clear();
|
||||||
|
|
||||||
if (m_query.status.Failed())
|
if (m_query.status.Failed())
|
||||||
{
|
{
|
||||||
// Reset query.
|
// Reset query.
|
||||||
m_query = new DtQueryData();
|
m_query = new DtQueryData();
|
||||||
return Results.Failure(path);
|
return DtStatus.DT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_query.startRef == m_query.endRef)
|
if (m_query.startRef == m_query.endRef)
|
||||||
|
@ -1364,7 +1367,7 @@ namespace DotRecast.Detour
|
||||||
// Reset query.
|
// Reset query.
|
||||||
m_query = new DtQueryData();
|
m_query = new DtQueryData();
|
||||||
|
|
||||||
return Results.Of(DtStatus.DT_SUCCSESS | details, path);
|
return DtStatus.DT_SUCCSESS | details;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest
|
/// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest
|
||||||
|
@ -1374,19 +1377,23 @@ namespace DotRecast.Detour
|
||||||
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
|
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
|
||||||
/// [(polyRef) * @p pathCount]
|
/// [(polyRef) * @p pathCount]
|
||||||
/// @returns The status flags for the query.
|
/// @returns The status flags for the query.
|
||||||
public virtual Result<List<long>> FinalizeSlicedFindPathPartial(List<long> existing)
|
public virtual DtStatus FinalizeSlicedFindPathPartial(List<long> existing, ref List<long> path)
|
||||||
{
|
{
|
||||||
List<long> path = new List<long>(64);
|
if (null == path)
|
||||||
|
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||||
|
|
||||||
|
path.Clear();
|
||||||
|
|
||||||
if (null == existing || existing.Count <= 0)
|
if (null == existing || existing.Count <= 0)
|
||||||
{
|
{
|
||||||
return Results.Failure(path);
|
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_query.status.Failed())
|
if (m_query.status.Failed())
|
||||||
{
|
{
|
||||||
// Reset query.
|
// Reset query.
|
||||||
m_query = new DtQueryData();
|
m_query = new DtQueryData();
|
||||||
return Results.Failure(path);
|
return DtStatus.DT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_query.startRef == m_query.endRef)
|
if (m_query.startRef == m_query.endRef)
|
||||||
|
@ -1409,18 +1416,19 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
m_query.status = DtStatus.DT_PARTIAL_RESULT;
|
m_query.status |= DtStatus.DT_PARTIAL_RESULT;
|
||||||
node = m_query.lastBestNode;
|
node = m_query.lastBestNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPathToNode(node, ref path);
|
GetPathToNode(node, ref path);
|
||||||
}
|
}
|
||||||
|
|
||||||
DtStatus status = m_query.status;
|
var details = m_query.status & DtStatus.DT_STATUS_DETAIL_MASK;
|
||||||
|
|
||||||
// Reset query.
|
// Reset query.
|
||||||
m_query = new DtQueryData();
|
m_query = new DtQueryData();
|
||||||
|
|
||||||
return Results.Of(status, path);
|
return DtStatus.DT_SUCCSESS | details;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DtStatus AppendVertex(RcVec3f pos, int flags, long refs, ref List<StraightPathItem> straightPath,
|
protected DtStatus AppendVertex(RcVec3f pos, int flags, long refs, ref List<StraightPathItem> straightPath,
|
||||||
|
@ -3362,28 +3370,28 @@ namespace DotRecast.Detour
|
||||||
* @remarks The result of this function depends on the state of the query object. For that reason it should only be
|
* @remarks The result of this function depends on the state of the query object. For that reason it should only be
|
||||||
* used immediately after one of the two Dijkstra searches, findPolysAroundCircle or findPolysAroundShape.
|
* used immediately after one of the two Dijkstra searches, findPolysAroundCircle or findPolysAroundShape.
|
||||||
*/
|
*/
|
||||||
public Result<List<long>> GetPathFromDijkstraSearch(long endRef)
|
public DtStatus GetPathFromDijkstraSearch(long endRef, ref List<long> path)
|
||||||
{
|
{
|
||||||
if (!m_nav.IsValidPolyRef(endRef))
|
if (!m_nav.IsValidPolyRef(endRef) || null == path)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<List<long>>("Invalid end ref");
|
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
path.Clear();
|
||||||
|
|
||||||
List<DtNode> nodes = m_nodePool.FindNodes(endRef);
|
List<DtNode> nodes = m_nodePool.FindNodes(endRef);
|
||||||
if (nodes.Count != 1)
|
if (nodes.Count != 1)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<List<long>>("Invalid end ref");
|
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
DtNode endNode = nodes[0];
|
DtNode endNode = nodes[0];
|
||||||
if ((endNode.flags & DT_NODE_CLOSED) == 0)
|
if ((endNode.flags & DT_NODE_CLOSED) == 0)
|
||||||
{
|
{
|
||||||
return Results.InvalidParam<List<long>>("Invalid end ref");
|
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = new List<long>();
|
return GetPathToNode(endNode, ref path);
|
||||||
GetPathToNode(endNode, ref path);
|
|
||||||
return Results.Success(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the path leading to the specified end node.
|
// Gets the path leading to the specified end node.
|
||||||
|
|
|
@ -22,14 +22,15 @@ using DotRecast.Core;
|
||||||
|
|
||||||
namespace DotRecast.Detour
|
namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
public class DtQueryData
|
public struct DtQueryData
|
||||||
{
|
{
|
||||||
public DtStatus status;
|
public DtStatus status;
|
||||||
public DtNode lastBestNode;
|
public DtNode lastBestNode;
|
||||||
public float lastBestNodeCost;
|
public float lastBestNodeCost;
|
||||||
public long startRef, endRef;
|
public long startRef;
|
||||||
public RcVec3f startPos = new RcVec3f();
|
public long endRef;
|
||||||
public RcVec3f endPos = new RcVec3f();
|
public RcVec3f startPos;
|
||||||
|
public RcVec3f endPos;
|
||||||
public IDtQueryFilter filter;
|
public IDtQueryFilter filter;
|
||||||
public int options;
|
public int options;
|
||||||
public float raycastLimitSqr;
|
public float raycastLimitSqr;
|
||||||
|
|
|
@ -21,7 +21,6 @@ freely, subject to the following restrictions:
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
|
|
||||||
namespace DotRecast.Detour
|
namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
|
||||||
recast4j copyright (c) 2015-2019 Piotr Piastucki piotr@jtilia.org
|
|
||||||
DotRecast Copyright (c) 2023 Choi Ikpil ikpil@naver.com
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace DotRecast.Detour.QueryResults
|
|
||||||
{
|
|
||||||
public static class Results
|
|
||||||
{
|
|
||||||
public static Result<T> Success<T>(T result)
|
|
||||||
{
|
|
||||||
return new Result<T>(result, DtStatus.DT_SUCCSESS, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Result<T> InvalidParam<T>()
|
|
||||||
{
|
|
||||||
return new Result<T>(default, DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Result<T> InvalidParam<T>(string message)
|
|
||||||
{
|
|
||||||
return new Result<T>(default, DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Result<T> Failure<T>(T result)
|
|
||||||
{
|
|
||||||
return new Result<T>(result, DtStatus.DT_FAILURE, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Result<T> Of<T>(DtStatus status, T result)
|
|
||||||
{
|
|
||||||
return new Result<T>(result, status, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly struct Result<T>
|
|
||||||
{
|
|
||||||
public readonly T result;
|
|
||||||
public readonly DtStatus status;
|
|
||||||
public readonly string message;
|
|
||||||
|
|
||||||
internal Result(T result, DtStatus status, string message)
|
|
||||||
{
|
|
||||||
this.result = result;
|
|
||||||
this.status = status;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public bool Failed()
|
|
||||||
{
|
|
||||||
return status.Failed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Succeeded()
|
|
||||||
{
|
|
||||||
return status.Succeeded();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,7 +23,7 @@ using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour;
|
using DotRecast.Detour;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using DotRecast.Recast.DemoTool.Builder;
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
using Silk.NET.OpenGL;
|
using Silk.NET.OpenGL;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ using System.Linq;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour;
|
using DotRecast.Detour;
|
||||||
using DotRecast.Detour.Crowd;
|
using DotRecast.Detour.Crowd;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using DotRecast.Recast.DemoTool.Builder;
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
using DotRecast.Recast.Demo.Draw;
|
using DotRecast.Recast.Demo.Draw;
|
||||||
using DotRecast.Recast.DemoTool;
|
using DotRecast.Recast.DemoTool;
|
||||||
|
|
|
@ -24,7 +24,7 @@ using DotRecast.Core;
|
||||||
using DotRecast.Detour;
|
using DotRecast.Detour;
|
||||||
using DotRecast.Detour.Crowd;
|
using DotRecast.Detour.Crowd;
|
||||||
using DotRecast.Detour.Crowd.Tracking;
|
using DotRecast.Detour.Crowd.Tracking;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using DotRecast.Recast.DemoTool.Builder;
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
using DotRecast.Recast.Demo.Draw;
|
using DotRecast.Recast.Demo.Draw;
|
||||||
using DotRecast.Recast.DemoTool;
|
using DotRecast.Recast.DemoTool;
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour;
|
using DotRecast.Detour;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using DotRecast.Recast.DemoTool.Builder;
|
using DotRecast.Recast.DemoTool.Builder;
|
||||||
using DotRecast.Recast.Demo.Draw;
|
using DotRecast.Recast.Demo.Draw;
|
||||||
using DotRecast.Recast.DemoTool;
|
using DotRecast.Recast.DemoTool;
|
||||||
|
@ -982,7 +982,7 @@ public class TestNavmeshTool : IRcTool
|
||||||
|
|
||||||
if (m_pathFindStatus.Succeeded())
|
if (m_pathFindStatus.Succeeded())
|
||||||
{
|
{
|
||||||
m_polys = m_navQuery.FinalizeSlicedFindPath().result;
|
m_navQuery.FinalizeSlicedFindPath(ref m_polys);
|
||||||
m_straightPath = null;
|
m_straightPath = null;
|
||||||
if (m_polys != null)
|
if (m_polys != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ freely, subject to the following restrictions:
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Crowd.Test;
|
namespace DotRecast.Detour.Crowd.Test;
|
||||||
|
|
|
@ -18,7 +18,7 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.Dynamic.Colliders;
|
using DotRecast.Detour.Dynamic.Colliders;
|
||||||
using DotRecast.Detour.Dynamic.Io;
|
using DotRecast.Detour.Dynamic.Io;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Dynamic.Test;
|
namespace DotRecast.Detour.Dynamic.Test;
|
||||||
|
|
|
@ -22,7 +22,7 @@ using System.Linq;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.Extras.Unity.Astar;
|
using DotRecast.Detour.Extras.Unity.Astar;
|
||||||
using DotRecast.Detour.Io;
|
using DotRecast.Detour.Io;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Test.Unity.Astar;
|
namespace DotRecast.Detour.Extras.Test.Unity.Astar;
|
||||||
|
|
|
@ -17,7 +17,7 @@ freely, subject to the following restrictions:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Test;
|
namespace DotRecast.Detour.Test;
|
||||||
|
|
|
@ -17,7 +17,7 @@ freely, subject to the following restrictions:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Test;
|
namespace DotRecast.Detour.Test;
|
||||||
|
|
|
@ -18,7 +18,7 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Test;
|
namespace DotRecast.Detour.Test;
|
||||||
|
@ -156,6 +156,7 @@ public class FindPathTest : AbstractDetourTest
|
||||||
public void TestFindPathSliced()
|
public void TestFindPathSliced()
|
||||||
{
|
{
|
||||||
IDtQueryFilter filter = new DtQueryDefaultFilter();
|
IDtQueryFilter filter = new DtQueryDefaultFilter();
|
||||||
|
var path = new List<long>();
|
||||||
for (int i = 0; i < startRefs.Length; i++)
|
for (int i = 0; i < startRefs.Length; i++)
|
||||||
{
|
{
|
||||||
long startRef = startRefs[i];
|
long startRef = startRefs[i];
|
||||||
|
@ -169,12 +170,12 @@ public class FindPathTest : AbstractDetourTest
|
||||||
status = query.UpdateSlicedFindPath(10, out var _);
|
status = query.UpdateSlicedFindPath(10, out var _);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<List<long>> path = query.FinalizeSlicedFindPath();
|
status = query.FinalizeSlicedFindPath(ref path);
|
||||||
Assert.That(path.status, Is.EqualTo(STATUSES[i]), $"index({i})");
|
Assert.That(status, Is.EqualTo(STATUSES[i]), $"index({i})");
|
||||||
Assert.That(path.result.Count, Is.EqualTo(RESULTS[i].Length));
|
Assert.That(path.Count, Is.EqualTo(RESULTS[i].Length));
|
||||||
for (int j = 0; j < RESULTS[i].Length; j++)
|
for (int j = 0; j < RESULTS[i].Length; j++)
|
||||||
{
|
{
|
||||||
Assert.That(path.result[j], Is.EqualTo(RESULTS[i][j]));
|
Assert.That(path[j], Is.EqualTo(RESULTS[i][j]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ freely, subject to the following restrictions:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Test;
|
namespace DotRecast.Detour.Test;
|
||||||
|
|
|
@ -17,7 +17,7 @@ freely, subject to the following restrictions:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Test;
|
namespace DotRecast.Detour.Test;
|
||||||
|
|
|
@ -17,7 +17,7 @@ freely, subject to the following restrictions:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Test;
|
namespace DotRecast.Detour.Test;
|
||||||
|
|
|
@ -19,7 +19,7 @@ freely, subject to the following restrictions:
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using static DotRecast.Core.RcMath;
|
using static DotRecast.Core.RcMath;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Test;
|
namespace DotRecast.Detour.Test;
|
||||||
|
|
|
@ -21,7 +21,7 @@ freely, subject to the following restrictions:
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using DotRecast.Detour.TileCache.Io;
|
using DotRecast.Detour.TileCache.Io;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ freely, subject to the following restrictions:
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DotRecast.Core;
|
using DotRecast.Core;
|
||||||
using DotRecast.Detour.QueryResults;
|
|
||||||
using DotRecast.Recast;
|
using DotRecast.Recast;
|
||||||
using DotRecast.Recast.Geom;
|
using DotRecast.Recast.Geom;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
Loading…
Reference in New Issue