コード例 #1
0
    void creaGenerateByHeritance(CreatureAI c)//generate creature
    {
        int        aim = Random.Range(0, GridList.Count - 1);
        GameObject f   = Instantiate(creaPrefab, GridList[aim].transform.position, Quaternion.identity) as GameObject;

        f.transform.position += new Vector3(0, 0.3f, 0);
        f.transform.parent    = creaHolder.transform;
        f.GetComponent <Movement>().gridpoints = this;
        f.GetComponent <Movement>().imOn       = true;
        CreatureAI brain = f.GetComponent <CreatureAI>();

        //brain.Genoma = c.Genoma;//<-
        brain = c;
        Creatures.Add(brain);
        brain.fatherReference = this;
        brain.UpdatePropertiesByNewGenoma();
        if (Predators)
        {
            if (Random.Range(1, 100) < PredatorsPercentage)
            {
                brain.AmIAPredator = 1;
            }
        }
        brain.ManifestFenotype();
        brain.setMyID(Creatures.Count - 1);
    }