Ejemplo n.º 1
0
    void SpawnSquare(SquareDNA dna)
    {
        Vector3          randomPos  = new Vector3(Random.Range(cameraRect.x, cameraRect.xMax), Random.Range(cameraRect.yMax, cameraRect.y), 0.0f);
        GameObject       individual = Instantiate(square, randomPos, Quaternion.identity) as GameObject;
        SquareController sq         = individual.GetComponent <SquareController>();

        if (sq == null)
        {
            Destroy(individual);
            return;
        }
        sq.cameraRect = cameraRect;
        population.Add(dna);
        sq.SetDNA(dna);
        //Debug.Log(dna);
    }