Пример #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
    /** 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();
    }
Пример #3
0
		public void Start()
		{
			this.cam = Camera.main;
			RVOSimulator rvosimulator = UnityEngine.Object.FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;
			if (rvosimulator == null)
			{
				base.enabled = false;
				throw new Exception("No RVOSimulator in the scene. Please add one");
			}
			this.sim = rvosimulator.GetSimulator();
		}
Пример #4
0
    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();
    }
Пример #5
0
		public void Start()
		{
			this.mesh = new Mesh();
			RVOSimulator rvosimulator = UnityEngine.Object.FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;
			if (rvosimulator == null)
			{
				Debug.LogError("No RVOSimulator could be found in the scene. Please add a RVOSimulator component to any GameObject");
				return;
			}
			this.sim = rvosimulator.GetSimulator();
			base.GetComponent<MeshFilter>().mesh = this.mesh;
			this.CreateAgents(this.agentCount);
		}
Пример #6
0
    public void Start()
    {
        mesh = new Mesh();
        RVOSimulator rvoSim = FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;

        if (rvoSim == null)
        {
            Debug.LogError("No RVOSimulator could be found in the scene. Please add a RVOSimulator component to any GameObject");
            return;
        }
        sim = rvoSim.GetSimulator();
        GetComponent <MeshFilter>().mesh = mesh;

        CreateAgents(agentCount);
    }
Пример #7
0
    public void Awake()
    {
        tr = transform;

        // Find the RVOSimulator in this scene
        if (cachedSimulator == null)
        {
            cachedSimulator = FindObjectOfType <RVOSimulator>();
        }

        if (cachedSimulator == null)
        {
            Debug.LogError("No RVOSimulator component found in the scene. Please add one.");
        }
        else
        {
            simulator = cachedSimulator.GetSimulator();
        }
    }
Пример #8
0
    public static Simulator GetSimulator()
    {
        if (null == AstarPath.active)
        {
            EB.Debug.LogError("No AstarPath component found in the scene.");
            return(null);
        }

        RVOSimulator sim = AstarPath.active.gameObject.GetComponent <RVOSimulator>();

        if (sim == null)
        {
            EB.Debug.LogError("No RVOSimulator component found in the scene. Please add one.");
            return(null);
        }
        Simulator simulator = sim.GetSimulator();

        if (simulator == null)
        {
            EB.Debug.LogError("No Simulator component found in the scene. Please add one.");
            return(null);
        }
        return(simulator);
    }