Ejemplo n.º 1
0
    private void Start()
    {
        squareMaxSpeed        = maxSpeed * maxSpeed;
        squareNeughbourRadius = neighbourRadius * neighbourRadius;
        squareAvoidanceRadius = squareNeughbourRadius * avoidanceRadiusMultiplier * avoidanceRadiusMultiplier;

        for (int i = 0; i < startingCount; i++)
        {
            FlockAgent newAgent = Instantiate(agentPrefab, Random.insideUnitCircle * startingCount * AgentDensity, Quaternion.Euler(Vector3.forward * Random.Range(0f, 360f)), transform);
            newAgent.inisialize(this);
            newAgent.name = "Agent " + i;

            agents.Add(newAgent);
        }
    }