Exemplo n.º 1
0
    void SetupDefaultFlock()
    {
        for (int i = 0; i < mNumOfBoids; i++)
        {
            GameObject newAgent = Instantiate(mBoidPrefab, new Vector3(Random.Range(18, 22), Random.Range(18, 22), Random.Range(18, 22)), Quaternion.Euler(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360)));
            newAgent.name             = "Boid " + i;
            newAgent.transform.parent = mAgentContainer.transform;
            Boids agentScript = newAgent.GetComponent <Boids>();
            agentScript.SetManager(this);
            agentScript.SetShouldFlock(true);

            AddBoid(agentScript);
            agentScript.SetTarget(mFlockTarget.transform.position);
        }
    }