private void CreateChildSpawners(LevelObjectType type, Level mum, Level dad) { SpawnerGroup dadSpawners = dad.GetSpawners(type); SpawnerGroup mumSpawners = mum.GetSpawners(type); SpawnerGroup newSpawners = new SpawnerGroup(mumSpawners); newSpawners.BuildFromParents(mumSpawners, dadSpawners); m_spawners[(int)type] = newSpawners; }
public SpawnerGroup(SpawnerGroup groupToCopy) { m_spawners = new Spawner[groupToCopy.m_spawners.Length]; for (int i = 0; i < m_spawners.Length; ++i) { m_spawners[i] = new Spawner(groupToCopy.m_spawners[i]); } m_spawnTypes = new SpawnType[groupToCopy.m_spawnTypes.Length]; for (int i = 0; i < m_spawnTypes.Length; ++i) { m_spawnTypes[i] = new SpawnType(groupToCopy.m_spawnTypes[i]); } }
public void BuildFromParents(SpawnerGroup mum, SpawnerGroup dad) { if (mum == null || dad == null) { return; } m_chromosome = mum.m_chromosome.MakeChild(dad.m_chromosome, m_mutationsPerReproduction); m_chromosome.Mutate(m_mutationsPerReproduction); m_chromosome.Reheat(); for (int i = 0; i < m_spawners.Length; ++i) { m_spawners[i].Gene = m_chromosome.Genes[i]; } m_chromosome.PrintData(); }
public void BuildFromParents(SpawnerGroup mum, SpawnerGroup dad) { if (mum == null || dad == null) return; m_chromosome = mum.m_chromosome.MakeChild(dad.m_chromosome, m_mutationsPerReproduction); m_chromosome.Mutate(m_mutationsPerReproduction); m_chromosome.Reheat(); for (int i = 0; i < m_spawners.Length; ++i) m_spawners[i].Gene = m_chromosome.Genes[i]; m_chromosome.PrintData(); }
public SpawnerGroup(SpawnerGroup groupToCopy) { m_spawners = new Spawner[groupToCopy.m_spawners.Length]; for (int i = 0; i < m_spawners.Length; ++i) m_spawners[i] = new Spawner(groupToCopy.m_spawners[i]); m_spawnTypes = new SpawnType[groupToCopy.m_spawnTypes.Length]; for (int i = 0; i < m_spawnTypes.Length; ++i) m_spawnTypes[i] = new SpawnType(groupToCopy.m_spawnTypes[i]); }