コード例 #1
0
    void setupScenario()
    {
        /* Specify the global time step of the simulation. */
        RVO.Simulator.Instance.setTimeStep(m_step);

        /*
         * Specify the default parameters for agents that are subsequently
         * added.
         */
        RVO.Simulator.Instance.setAgentDefaults(15.0f, 10, 10.0f, 10.0f, 1.5f, 2.0f, new RVO.Vector2(0.0f, 0.0f));

        /*
         * Add agents, specifying their start position, and store their
         * goals on the opposite side of the environment.
         */
        GameObject prefab = Resources.Load("agent") as GameObject;

        for (int i = 0; i < 250; ++i)
        {
            RVO.Simulator.Instance.addAgent(200.0f *
                                            new RVO.Vector2((float)Math.Cos(i * 2.0f * Math.PI / 250.0f),
                                                            (float)Math.Sin(i * 2.0f * Math.PI / 250.0f)));
            m_goals.Add(-RVO.Simulator.Instance.getAgentPosition(i));

            GameObject go = GameObject.Instantiate(prefab) as GameObject;
            go.name = "agent" + i;
            Agent1 agent = go.AddComponent <Agent1>();
            agent.Init(i);
        }
    }
コード例 #2
0
    void SetAgent1()
    {
        GameObject prefab = Resources.Load("agent") as GameObject;
        {
            RVO.Simulator.Instance.addAgent(new RVO.Vector2(-10, 0));
            m_goals.Add(new RVO.Vector2(10, 0));

            GameObject go = GameObject.Instantiate(prefab) as GameObject;
            go.name = "agent" + 1;
            Agent1 agent = go.AddComponent <Agent1>();
            agent.Init(1);
        }
    }
コード例 #3
0
    void SetAgent0()
    {
        GameObject prefab = Resources.Load("testCustomRVOAgent") as GameObject;
        {
            RVO.Simulator.Instance.addAgent(new RVO.Vector2(0, -10), 10, 10, 10, 10, 0.5f, 1, new RVO.Vector2(0, 0));
            m_goals.Add(new RVO.Vector2(0, 10));

            GameObject go = GameObject.Instantiate(prefab) as GameObject;
            go.name = "agent" + 0;
            Agent1 agent = go.AddComponent <Agent1>();
            agent.Init(0);
        }
    }
コード例 #4
0
    void SetWall()
    {
        GameObject prefab = Resources.Load("testCustomRVOAgent") as GameObject;

        for (int i = 0; i <= 0; i++)
        {
            for (int j = 0; j <= 0; ++j)
            {
                int id = RVO.Simulator.Instance.addAgent(new RVO.Vector2(i, j), 10, 10, 10, 10, 0.5f, 1, new RVO.Vector2(0, 0));

                GameObject go = GameObject.Instantiate(prefab) as GameObject;
                go.name = "agent " + id;
                Agent1 agent = go.AddComponent <Agent1>();
                agent.Init(id);
            }
        }
    }