change public api in StraightPathItem

This commit is contained in:
ikpil 2023-07-26 00:03:48 +09:00
parent f9c79c9b71
commit 04fd0abea0
6 changed files with 32 additions and 47 deletions

View File

@ -944,7 +944,7 @@ namespace DotRecast.Detour.Crowd
// and short cut to there.
if ((ag.option.updateFlags & DtCrowdAgentParams.DT_CROWD_OPTIMIZE_VIS) != 0 && ag.corners.Count > 0)
{
RcVec3f target = ag.corners[Math.Min(1, ag.corners.Count - 1)].GetPos();
RcVec3f target = ag.corners[Math.Min(1, ag.corners.Count - 1)].pos;
ag.corridor.OptimizePathVisibility(target, ag.option.pathOptimizationRange, _navQuery,
_filters[ag.option.queryFilterType]);
@ -993,7 +993,7 @@ namespace DotRecast.Detour.Crowd
// Adjust the path over the off-mesh connection.
long[] refs = new long[2];
if (ag.corridor.MoveOverOffmeshConnection(ag.corners[ag.corners.Count - 1].GetRef(), refs, ref anim.startPos,
if (ag.corridor.MoveOverOffmeshConnection(ag.corners[ag.corners.Count - 1].refs, refs, ref anim.startPos,
ref anim.endPos, _navQuery))
{
anim.initPos = ag.npos;

View File

@ -131,13 +131,13 @@ namespace DotRecast.Detour.Crowd
if (0 == corners.Count)
return false;
bool offMeshConnection = ((corners[corners.Count - 1].GetFlags()
bool offMeshConnection = ((corners[corners.Count - 1].flags
& DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
? true
: false;
if (offMeshConnection)
{
float distSq = RcVec3f.Dist2DSqr(npos, corners[corners.Count - 1].GetPos());
float distSq = RcVec3f.Dist2DSqr(npos, corners[corners.Count - 1].pos);
if (distSq < radius * radius)
return true;
}
@ -150,9 +150,9 @@ namespace DotRecast.Detour.Crowd
if (0 == corners.Count)
return range;
bool endOfPath = ((corners[corners.Count - 1].GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0) ? true : false;
bool endOfPath = ((corners[corners.Count - 1].flags & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0) ? true : false;
if (endOfPath)
return Math.Min(RcVec3f.Dist2D(npos, corners[corners.Count - 1].GetPos()), range);
return Math.Min(RcVec3f.Dist2D(npos, corners[corners.Count - 1].pos), range);
return range;
}
@ -164,8 +164,8 @@ namespace DotRecast.Detour.Crowd
{
int ip0 = 0;
int ip1 = Math.Min(1, corners.Count - 1);
var p0 = corners[ip0].GetPos();
var p1 = corners[ip1].GetPos();
var p0 = corners[ip0].pos;
var p1 = corners[ip1].pos;
var dir0 = p0.Subtract(npos);
var dir1 = p1.Subtract(npos);
@ -191,7 +191,7 @@ namespace DotRecast.Detour.Crowd
RcVec3f dir = new RcVec3f();
if (0 < corners.Count)
{
dir = corners[0].GetPos().Subtract(npos);
dir = corners[0].pos.Subtract(npos);
dir.y = 0;
dir.Normalize();
}

View File

@ -123,8 +123,8 @@ namespace DotRecast.Detour.Crowd
int start = 0;
foreach (StraightPathItem spi in corners)
{
if ((spi.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0
|| RcVec3f.Dist2DSqr(spi.GetPos(), m_pos) > MIN_TARGET_DIST)
if ((spi.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0
|| RcVec3f.Dist2DSqr(spi.pos, m_pos) > MIN_TARGET_DIST)
{
break;
}
@ -137,7 +137,7 @@ namespace DotRecast.Detour.Crowd
for (int i = start; i < corners.Count; i++)
{
StraightPathItem spi = corners[i];
if ((spi.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
if ((spi.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
{
end = i + 1;
break;

View File

@ -35,20 +35,5 @@ namespace DotRecast.Detour
this.flags = flags;
this.refs = refs;
}
public RcVec3f GetPos()
{
return pos;
}
public int GetFlags()
{
return flags;
}
public long GetRef()
{
return refs;
}
}
}

View File

@ -426,16 +426,16 @@ public class CrowdTool : IRcTool
dd.Begin(LINES, 2.0f);
for (int j = 0; j < ag.corners.Count; ++j)
{
RcVec3f va = j == 0 ? pos : ag.corners[j - 1].GetPos();
RcVec3f vb = ag.corners[j].GetPos();
RcVec3f va = j == 0 ? pos : ag.corners[j - 1].pos;
RcVec3f vb = ag.corners[j].pos;
dd.Vertex(va.x, va.y + radius, va.z, DuRGBA(128, 0, 0, 192));
dd.Vertex(vb.x, vb.y + radius, vb.z, DuRGBA(128, 0, 0, 192));
}
if ((ag.corners[ag.corners.Count - 1].GetFlags()
if ((ag.corners[ag.corners.Count - 1].flags
& DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
{
RcVec3f v = ag.corners[ag.corners.Count - 1].GetPos();
RcVec3f v = ag.corners[ag.corners.Count - 1].pos;
dd.Vertex(v.x, v.y, v.z, DuRGBA(192, 0, 0, 192));
dd.Vertex(v.x, v.y + radius * 2, v.z, DuRGBA(192, 0, 0, 192));
}

View File

@ -456,7 +456,7 @@ public class TestNavmeshTool : IRcTool
StraightPathItem straightPathItem = m_straightPath[i];
StraightPathItem straightPathItem2 = m_straightPath[i + 1];
int col;
if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
{
col = offMeshCol;
}
@ -465,10 +465,10 @@ public class TestNavmeshTool : IRcTool
col = spathCol;
}
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
straightPathItem.GetPos().z, col);
dd.Vertex(straightPathItem2.GetPos().x, straightPathItem2.GetPos().y + 0.4f,
straightPathItem2.GetPos().z, col);
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
straightPathItem.pos.z, col);
dd.Vertex(straightPathItem2.pos.x, straightPathItem2.pos.y + 0.4f,
straightPathItem2.pos.z, col);
}
dd.End();
@ -477,15 +477,15 @@ public class TestNavmeshTool : IRcTool
{
StraightPathItem straightPathItem = m_straightPath[i];
int col;
if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_START) != 0)
if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_START) != 0)
{
col = startCol;
}
else if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0)
else if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_END) != 0)
{
col = endCol;
}
else if ((straightPathItem.GetFlags() & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
else if ((straightPathItem.flags & DtNavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
{
col = offMeshCol;
}
@ -494,8 +494,8 @@ public class TestNavmeshTool : IRcTool
col = spathCol;
}
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
straightPathItem.GetPos().z, col);
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
straightPathItem.pos.z, col);
}
dd.End();
@ -523,10 +523,10 @@ public class TestNavmeshTool : IRcTool
{
StraightPathItem straightPathItem = m_straightPath[i];
StraightPathItem straightPathItem2 = m_straightPath[i + 1];
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
straightPathItem.GetPos().z, spathCol);
dd.Vertex(straightPathItem2.GetPos().x, straightPathItem2.GetPos().y + 0.4f,
straightPathItem2.GetPos().z, spathCol);
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
straightPathItem.pos.z, spathCol);
dd.Vertex(straightPathItem2.pos.x, straightPathItem2.pos.y + 0.4f,
straightPathItem2.pos.z, spathCol);
}
dd.End();
@ -534,8 +534,8 @@ public class TestNavmeshTool : IRcTool
for (int i = 0; i < m_straightPath.Count; ++i)
{
StraightPathItem straightPathItem = m_straightPath[i];
dd.Vertex(straightPathItem.GetPos().x, straightPathItem.GetPos().y + 0.4f,
straightPathItem.GetPos().z, spathCol);
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f,
straightPathItem.pos.z, spathCol);
}
dd.End();