コード例 #1
0
    void SpawnMonster(Monster monster)
    {
        Genome fatherGenome = new Genome(Codex.DNAPool[Random.Range(0, Codex.DNAPool.Count)]);
        Genome motherGenome = new Genome(Codex.DNAPool[Random.Range(0, Codex.DNAPool.Count)]);

        monster.Genome   = Genome.Breeding(fatherGenome, motherGenome);
        monster.Creature = CreateCreature(fatherGenome.VisibileDNA, motherGenome.VisibileDNA);
        monster.BuildProperty();
    }
コード例 #2
0
    void SpawnMonster()
    {
        GameObject.Destroy(fatherMap.gameObject);
        GameObject.Destroy(motherMap.gameObject);

        Genome fatherGenome = new Genome(Codex.DNAPool[fatherID]);
        Genome motherGenome = new Genome(Codex.DNAPool[motherID]);

        CreateMonster();
        monster.Genome   = Genome.Breeding(fatherGenome, motherGenome);
        monster.Creature = CreateCreature(fatherGenome.VisibileDNA, motherGenome.VisibileDNA);
        monster.BuildProperty();
    }
コード例 #3
0
    void BreedingNextGeneration()
    {
        Genome   oldGenome   = monster.Genome;
        Genome   otherGenome = new Genome(Codex.DNAPool[otherID]);
        Genome   newGenome;
        Creature creature;

        if (Random.Range(0, 1) == 1)
        {
            creature  = CreateCreature(oldGenome.VisibileDNA, otherGenome.VisibileDNA);
            newGenome = Genome.Breeding(oldGenome, otherGenome);
        }
        else
        {
            creature  = CreateCreature(otherGenome.VisibileDNA, oldGenome.VisibileDNA);
            newGenome = Genome.Breeding(otherGenome, oldGenome);
        }

        CreateMonster();
        monster.Creature = creature;
        monster.Genome   = newGenome;
        monster.BuildProperty();
    }