Advertisement
Guest User

Untitled

a guest
Jul 29th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.68 KB | None | 0 0
  1. diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs
  2. index e7ae7e12..06ea01d0 100644
  3. --- a/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs
  4. +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOAgent.cs
  5. @@ -37,6 +37,10 @@ namespace Pathfinding.RVO.Sampled {
  6.  
  7.         #region IAgent Properties
  8.  
  9. +       public string AgentName {get; set;}
  10. +
  11. +       public string IgnoredAgentName {get; set;}
  12. +
  13.         /** \copydoc Pathfinding::RVO::IAgent::Position */
  14.         public Vector2 Position { get; set; }
  15.  
  16. @@ -266,7 +270,7 @@ namespace Pathfinding.RVO.Sampled {
  17.          */
  18.         internal float InsertAgentNeighbour (Agent agent, float rangeSq) {
  19.             // Check if this agent collides with the other agent
  20. -           if (this == agent || (agent.layer & collidesWith) == 0) return rangeSq;
  21. +           if (this == agent || (agent.layer & collidesWith) == 0 || (this.IgnoredAgentName != "" && this.IgnoredAgentName == agent.AgentName)) return rangeSq;
  22.  
  23.             // 2D distance
  24.             float dist = (agent.position - position).sqrMagnitude;
  25. diff --git a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs
  26. index 10446f4a..9747797e 100644
  27. --- a/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs
  28. +++ b/Assets/AstarPathfindingProject/Core/RVO/RVOCoreSimulator.cs
  29. @@ -21,6 +21,9 @@ namespace Pathfinding.RVO {
  30.      * \astarpro
  31.      */
  32.     public interface IAgent {
  33. +       public string AgentName {get; set;}
  34. +       public string IgnoredAgentName {get; set;}
  35. +
  36.         /** Position of the agent.
  37.          * The agent does not move by itself, a movement script has to be responsible for
  38.          * reading the CalculatedTargetPoint and CalculatedSpeed properties and move towards that point with that speed.
  39. diff --git a/Assets/AstarPathfindingProject/RVO/RVOController.cs b/Assets/AstarPathfindingProject/RVO/RVOController.cs
  40. index f6f3e06a..32a3dcaa 100644
  41. --- a/Assets/AstarPathfindingProject/RVO/RVOController.cs
  42. +++ b/Assets/AstarPathfindingProject/RVO/RVOController.cs
  43. @@ -163,6 +163,9 @@ namespace Pathfinding.RVO {
  44.         /** Enables drawing debug information in the scene view */
  45.         public bool debug;
  46.  
  47. +       public string agentName;
  48. +       public string ignoredAgentName;
  49. +
  50.         /** Current position of the agent.
  51.          * Note that this is only updated every local avoidance simulation step, not every frame.
  52.          */
  53. @@ -317,6 +320,8 @@ namespace Pathfinding.RVO {
  54.             rvoAgent.Layer = layer;
  55.             rvoAgent.CollidesWith = collidesWith;
  56.             rvoAgent.Priority = priority;
  57. +           rvoAgent.agentName = agentName;
  58. +           rvoAgent.ignoredAgentName = ignoredAgentName;
  59.  
  60.             float elevation;
  61.             // Use the position from the movement script if one is attached
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement