/** Removes obstacles which were added with AddGraphObstacles */ public void RemoveObstacles() { #if BNICKSON_UPDATED if (lastSim != null) { // if our usage of APP changes, this will throw an error throw new System.Exception("This section of A Star Pathfinding code should never be executed"); } #else if (lastSim == null) { return; } Pathfinding.RVO.Simulator sim = lastSim; lastSim = null; for (int i = 0; i < obstacles.Count; i++) { sim.RemoveObstacle(obstacles[i]); } obstacles.Clear(); #endif }
// destroy the static obstacles we already have private void RemoveStaticObstacles(Pathfinding.RVO.Simulator sim) { if (null != _staticObstacles) { for (int i = 0; i < _staticObstacles.Count; i++) { sim.RemoveObstacle(_staticObstacles[i]); } _staticObstacles.Clear(); } }
/// <summary>Removes all obstacles which have been added by this component</summary> public void RemoveObstacles() { if (lastSim != null) { for (int i = 0; i < obstacles.Count; i++) { lastSim.RemoveObstacle(obstacles[i]); } lastSim = null; } obstacles.Clear(); }
public void RemoveObstacles() { if (this.lastSim == null) { return; } Simulator simulator = this.lastSim; this.lastSim = null; for (int i = 0; i < this.obstacles.Count; i++) { simulator.RemoveObstacle(this.obstacles[i]); } this.obstacles.Clear(); }
/** Disables the obstacle. * Do not override this function */ public void OnDisable() { if (addedObstacles != null) { if (sim == null) { throw new System.Exception("This should not happen! Make sure you are not overriding the OnEnable function"); } for (int i = 0; i < addedObstacles.Count; i++) { sim.RemoveObstacle(addedObstacles[i]); } } }
/** Removes obstacles which were added with AddGraphObstacles */ public void RemoveObstacles() { if (lastSim == null) { return; } Pathfinding.RVO.Simulator sim = lastSim; lastSim = null; for (int i = 0; i < obstacles.Count; i++) { sim.RemoveObstacle(obstacles[i]); } obstacles.Clear(); }