public Chromosome(Chromosome chromosomeToCopy) { _chromosomeData = new bool[chromosomeToCopy._chromosomeData.Length]; _isSynchronized = chromosomeToCopy._isSynchronized; _genes = new Gene[chromosomeToCopy.Genes.Length]; for(int i = 0; i < _genes.Length; ++i) _genes[i] = new Gene(chromosomeToCopy._genes[i]); Cook(); }
public Chromosome(Chromosome chromosomeToCopy) { _chromosomeData = new bool[chromosomeToCopy._chromosomeData.Length]; _isSynchronized = chromosomeToCopy._isSynchronized; _genes = new Gene[chromosomeToCopy.Genes.Length]; for (int i = 0; i < _genes.Length; ++i) { _genes[i] = new Gene(chromosomeToCopy._genes[i]); } Cook(); }
public SpawnerGroup(Spawner[] spawners, SpawnType[] spawnTypes) { m_spawners = spawners; m_spawnTypes = spawnTypes; Gene[] genes = new Gene[spawners.Length]; for(int i = 0; i < m_spawners.Length; ++i) genes[i] = m_spawners[i].Gene; m_chromosome = new Chromosome(genes); float totalAppearanceRates = 0; for (int i = 0; i < spawnTypes.Length; ++i) totalAppearanceRates += m_spawnTypes[i].appearanceRate; m_spawnTypes[0].appearanceRate = m_spawnTypes[0].appearanceRate / totalAppearanceRates; for (int i = 1; i < spawnTypes.Length; ++i) m_spawnTypes[i].appearanceRate = m_spawnTypes[i].appearanceRate / totalAppearanceRates + m_spawnTypes[i - 1].appearanceRate; #if DEBUG string debugstring = "Ratios : "; for (int i = 0; i < spawnTypes.Length; ++i) debugstring += " " + m_spawnTypes[i].appearanceRate / totalAppearanceRates; #endif }
public Spawner(Spawner spawnerToCopy) { m_owner = spawnerToCopy.m_owner; m_gene = new Gene(spawnerToCopy.m_gene); m_spawnArea = spawnerToCopy.m_spawnArea; }
public Spawner(Gene sectionGene, IArea spawnArea) { m_owner = null; m_gene = sectionGene; m_spawnArea = spawnArea; }
public Spawner(GameObject owner, Gene sectionGene, IArea spawnArea) { m_owner = owner; m_gene = sectionGene; m_spawnArea = spawnArea; }
public Gene(Gene geneToCopy) { m_value = geneToCopy.m_value; m_maxValue = geneToCopy.m_maxValue; m_length = geneToCopy.m_length; }
public Chromosome(Gene[] genes) { _isSynchronized = true; _genes = genes; Cook(); }