diff --git a/src/DotRecast.Detour.Crowd/Crowd.cs b/src/DotRecast.Detour.Crowd/Crowd.cs index 7ca3580..884b4e0 100644 --- a/src/DotRecast.Detour.Crowd/Crowd.cs +++ b/src/DotRecast.Detour.Crowd/Crowd.cs @@ -22,6 +22,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using DotRecast.Core; using DotRecast.Detour.Crowd.Tracking; using DotRecast.Detour.QueryResults; @@ -354,7 +355,7 @@ namespace DotRecast.Detour.Crowd * * @return List of active agents */ - public ICollection GetActiveAgents() + public IList GetActiveAgents() { return _agents; } @@ -395,7 +396,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Start(); - ICollection agents = GetActiveAgents(); + IList agents = GetActiveAgents(); // Check that all agents still have valid paths. CheckPathValidity(agents, dt); @@ -438,7 +439,7 @@ namespace DotRecast.Detour.Crowd } - private void CheckPathValidity(ICollection agents, float dt) + private void CheckPathValidity(IList agents, float dt) { _telemetry.Start("checkPathValidity"); @@ -560,7 +561,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("checkPathValidity"); } - private void UpdateMoveRequest(ICollection agents, float dt) + private void UpdateMoveRequest(IList agents, float dt) { _telemetry.Start("updateMoveRequest"); @@ -820,7 +821,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("updateMoveRequest"); } - private void UpdateTopologyOptimization(ICollection agents, float dt) + private void UpdateTopologyOptimization(IList agents, float dt) { _telemetry.Start("updateTopologyOptimization"); @@ -861,10 +862,11 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("updateTopologyOptimization"); } - private void BuildProximityGrid(ICollection agents) + private void BuildProximityGrid(IList agents) { _telemetry.Start("buildProximityGrid"); _grid = new ProximityGrid(_config.maxAgentRadius * 3); + foreach (CrowdAgent ag in agents) { Vector3f p = ag.npos; @@ -875,7 +877,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("buildProximityGrid"); } - private void BuildNeighbours(ICollection agents) + private void BuildNeighbours(IList agents) { _telemetry.Start("buildNeighbours"); foreach (CrowdAgent ag in agents) @@ -935,7 +937,7 @@ namespace DotRecast.Detour.Crowd return result; } - private void FindCorners(ICollection agents, CrowdAgentDebugInfo debug) + private void FindCorners(IList agents, CrowdAgentDebugInfo debug) { _telemetry.Start("findCorners"); CrowdAgent debugAgent = debug != null ? debug.agent : null; @@ -984,7 +986,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("findCorners"); } - private void TriggerOffMeshConnections(ICollection agents) + private void TriggerOffMeshConnections(IList agents) { _telemetry.Start("triggerOffMeshConnections"); foreach (CrowdAgent ag in agents) @@ -1033,7 +1035,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("triggerOffMeshConnections"); } - private void CalculateSteering(ICollection agents) + private void CalculateSteering(IList agents) { _telemetry.Start("calculateSteering"); foreach (CrowdAgent ag in agents) @@ -1131,7 +1133,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("calculateSteering"); } - private void PlanVelocity(CrowdAgentDebugInfo debug, ICollection agents) + private void PlanVelocity(CrowdAgentDebugInfo debug, IList agents) { _telemetry.Start("planVelocity"); CrowdAgent debugAgent = debug != null ? debug.agent : null; @@ -1206,7 +1208,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("planVelocity"); } - private void Integrate(float dt, ICollection agents) + private void Integrate(float dt, IList agents) { _telemetry.Start("integrate"); foreach (CrowdAgent ag in agents) @@ -1222,7 +1224,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("integrate"); } - private void HandleCollisions(ICollection agents) + private void HandleCollisions(IList agents) { _telemetry.Start("handleCollisions"); for (int iter = 0; iter < 4; ++iter) @@ -1299,7 +1301,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("handleCollisions"); } - private void MoveAgents(ICollection agents) + private void MoveAgents(IList agents) { _telemetry.Start("moveAgents"); foreach (CrowdAgent ag in agents) @@ -1326,7 +1328,7 @@ namespace DotRecast.Detour.Crowd _telemetry.Stop("moveAgents"); } - private void UpdateOffMeshConnections(ICollection agents, float dt) + private void UpdateOffMeshConnections(IList agents, float dt) { _telemetry.Start("updateOffMeshConnections"); foreach (CrowdAgent ag in agents) diff --git a/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs b/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs index af2e9ac..d111c64 100644 --- a/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs +++ b/src/DotRecast.Detour.Crowd/Tracking/ObstacleAvoidanceDebugData.cs @@ -27,15 +27,15 @@ namespace DotRecast.Detour.Crowd.Tracking public class ObstacleAvoidanceDebugData { - int m_nsamples; - int m_maxSamples; - float[] m_vel; - float[] m_ssize; - float[] m_pen; - float[] m_vpen; - float[] m_vcpen; - float[] m_spen; - float[] m_tpen; + private int m_nsamples; + private int m_maxSamples; + private float[] m_vel; + private float[] m_ssize; + private float[] m_pen; + private float[] m_vpen; + private float[] m_vcpen; + private float[] m_spen; + private float[] m_tpen; public ObstacleAvoidanceDebugData(int maxSamples) {