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(); }
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(); }
protected void FindSimulator() { RVOSimulator rvosimulator = UnityEngine.Object.FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator; if (rvosimulator == null) { throw new InvalidOperationException("No RVOSimulator could be found in the scene. Please add one to any GameObject"); } this.sim = rvosimulator.GetSimulator(); }
/** Finds a simulator in the scene. * * Saves found simulator in #sim. * * \throws System.InvalidOperationException When no RVOSimulator could be found. */ protected void FindSimulator() { RVOSimulator rvosim = FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator; if (rvosim == null) { throw new System.InvalidOperationException("No RVOSimulator could be found in the scene. Please add one to any GameObject"); } sim = rvosim.GetSimulator(); }
// Token: 0x0600079A RID: 1946 RVA: 0x00049C98 File Offset: 0x00048098 public void Awake() { this.tr = base.transform; RVOSimulator rvosimulator = UnityEngine.Object.FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator; if (rvosimulator == null) { Debug.LogError("No RVOSimulator component found in the scene. Please add one."); return; } this.simulator = rvosimulator.GetSimulator(); }
public void Awake() { tr = transform; RVOSimulator sim = FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator; if (sim == null) { Debug.LogError("No RVOSimulator component found in the scene. Please add one."); return; } simulator = sim.GetSimulator(); }
public void Awake() { tr = transform; // Find the RVOSimulator in this scene cachedSimulator = cachedSimulator ?? FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator; if (cachedSimulator == null) { Debug.LogError("No RVOSimulator component found in the scene. Please add one."); } else { simulator = cachedSimulator.GetSimulator(); } }
public void EnsureActorAndSimulator() { if (!this.actor) { this.actor = ActorHelper.GetActorRoot(base.gameObject); } if (this.simulator == null) { RVOSimulator instance = RVOSimulator.GetInstance(); if (instance == null) { return; } this.simulator = instance.GetSimulator(); } if (this.simulator == null) { return; } VInt3 vInt; if (this.actor) { vInt = this.actor.handle.location; } else { vInt = (VInt3)base.transform.position; } if (this.rvoAgent != null) { if (!this.simulator.GetAgents().Contains(this.rvoAgent)) { this.simulator.AddAgent(this.rvoAgent); } } else { this.rvoAgent = this.simulator.AddAgent(vInt); } if (this.rvoAgent != null) { this.rvoAgent.owner = base.gameObject; } this.UpdateAgentProperties(); this.rvoAgent.Teleport(vInt); this.adjustedY = this.rvoAgent.Position.y; }
public void Awake() { this.tr = base.transform; if (cachedSimulator == null) { cachedSimulator = UnityEngine.Object.FindObjectOfType <RVOSimulator>(); } if (cachedSimulator == null) { Debug.LogError("No RVOSimulator component found in the scene. Please add one."); } else { this.simulator = cachedSimulator.GetSimulator(); } }
public override void OnLatePostScan() { if (!Application.isPlaying) { return; } Profiler.BeginSample("Update RVO Obstacles From Graphs"); RemoveObstacles(); NavGraph[] graphs = AstarPath.active.graphs; RVOSimulator rvosim = RVOSimulator.active; if (rvosim == null) { throw new System.NullReferenceException("No RVOSimulator could be found in the scene. Please add one to any GameObject"); } // Remember which simulator these obstacles were added to lastSim = rvosim.GetSimulator(); for (int i = 0; i < graphs.Length; i++) { RecastGraph recast = graphs[i] as RecastGraph; INavmesh navmesh = graphs[i] as INavmesh; GridGraph grid = graphs[i] as GridGraph; if (recast != null) { foreach (var tile in recast.GetTiles()) { AddGraphObstacles(lastSim, tile); } } else if (navmesh != null) { AddGraphObstacles(lastSim, navmesh); } else if (grid != null) { AddGraphObstacles(lastSim, grid); } } Profiler.EndSample(); }
public override void OnLatePostScan() { if (!Application.isPlaying) { return; } RemoveObstacles(); NavGraph[] graphs = AstarPath.active.graphs; RVOSimulator rvosim = FindObjectOfType <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++) { var recast = graphs[i] as RecastGraph; if (recast != null) { foreach (var tile in recast.GetTiles()) { AddGraphObstacles(sim, tile); } } else { var navmesh = graphs[i] as INavmesh; if (navmesh != null) { AddGraphObstacles(sim, navmesh); } } } sim.UpdateObstacles(); }
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(); }
public override void OnLatePostScan() { if (!Application.isPlaying) { return; } this.RemoveObstacles(); NavGraph[] graphs = AstarPath.active.graphs; RVOSimulator active = RVOSimulator.active; if (active == null) { throw new NullReferenceException("No RVOSimulator could be found in the scene. Please add one to any GameObject"); } this.lastSim = active.GetSimulator(); for (int i = 0; i < graphs.Length; i++) { RecastGraph recastGraph = graphs[i] as RecastGraph; INavmesh navmesh = graphs[i] as INavmesh; GridGraph gridGraph = graphs[i] as GridGraph; if (recastGraph != null) { foreach (NavmeshTile ng in recastGraph.GetTiles()) { this.AddGraphObstacles(this.lastSim, ng); } } else if (navmesh != null) { this.AddGraphObstacles(this.lastSim, navmesh); } else if (gridGraph != null) { this.AddGraphObstacles(this.lastSim, gridGraph); } } }
public void Awake () { tr = transform; // Find the RVOSimulator in this scene cachedSimulator = cachedSimulator ?? FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator; if (cachedSimulator == null) { Debug.LogError("No RVOSimulator component found in the scene. Please add one."); } else { simulator = cachedSimulator.GetSimulator(); } }