UpdateObstacles() public method

public UpdateObstacles ( ) : void
return void
示例#1
0
    public override void OnLatePostScan()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        RemoveObstacles();

        NavGraph[] graphs = AstarPath.active.graphs;

        RVOSimulator rvosim = FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;

        if (rvosim == null)
        {
            throw new System.NullReferenceException("No RVOSimulator could be found in the scene. Please add one to any GameObject");
        }

        Pathfinding.RVO.Simulator sim = rvosim.GetSimulator();

        for (int i = 0; i < graphs.Length; i++)
        {
            AddGraphObstacles(sim, graphs[i]);
        }

        sim.UpdateObstacles();
    }
示例#2
0
		public override void OnLatePostScan()
		{
			if (!Application.isPlaying)
			{
				return;
			}
			this.RemoveObstacles();
			NavGraph[] graphs = AstarPath.active.graphs;
			RVOSimulator rvosimulator = UnityEngine.Object.FindObjectOfType<RVOSimulator>();
			if (rvosimulator == null)
			{
				throw new NullReferenceException("No RVOSimulator could be found in the scene. Please add one to any GameObject");
			}
			Simulator simulator = rvosimulator.GetSimulator();
			for (int i = 0; i < graphs.Length; i++)
			{
				RecastGraph recastGraph = graphs[i] as RecastGraph;
				if (recastGraph != null)
				{
					foreach (RecastGraph.NavmeshTile ng in recastGraph.GetTiles())
					{
						this.AddGraphObstacles(simulator, ng);
					}
				}
				else
				{
					INavmesh navmesh = graphs[i] as INavmesh;
					if (navmesh != null)
					{
						this.AddGraphObstacles(simulator, navmesh);
					}
				}
			}
			simulator.UpdateObstacles();
		}
示例#3
0
        public override void OnLatePostScan()
        {
            if (!Application.isPlaying)
            {
                return;
            }
            this.RemoveObstacles();
            NavGraph[]   graphs       = AstarPath.active.graphs;
            RVOSimulator rVOSimulator = UnityEngine.Object.FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;

            if (rVOSimulator == null)
            {
                throw new NullReferenceException("No RVOSimulator could be found in the scene. Please add one to any GameObject");
            }
            Simulator simulator = rVOSimulator.GetSimulator();

            for (int i = 0; i < graphs.Length; i++)
            {
                this.AddGraphObstacles(simulator, graphs[i]);
            }
            simulator.UpdateObstacles();
        }