public virtual void OnSpawn(Spawner section)
 {
     throw new NotImplementedException();
 }
        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 override void OnSpawn(Spawner section)
 {
     //base.OnSpawn(section);
 }
 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 Spawner(Spawner spawnerToCopy)
 {
     m_owner = spawnerToCopy.m_owner;
     m_gene = new Gene(spawnerToCopy.m_gene);
     m_spawnArea = spawnerToCopy.m_spawnArea;
 }
Exemple #6
0
 public override void OnSpawn(Spawner section)
 {
 }
 private void CreateSpawnersFirstTime()
 {
     ///
     ///Ground Spawners
     ///
     Spawner[] groundSpawners = new Spawner[ActiveTileCount * GroundEnemySpawnersPerTile];
     float increment = ActiveAreaWidth / (float)groundSpawners.Length;
     for (int i = 0; i < groundSpawners.Length; ++i)
         groundSpawners[i] = new Spawner(new Gene(8), new PastaGameLibrary.UnitPoint(new Transform(), new Vector2(EarthTile.EarthTileWidth + i * increment, 0)));
     m_spawners[(int)LevelObjectType.GroundEnemy] = new SpawnerGroup(groundSpawners, LevelGenerator.GroundSpawnTypes);
 }
 public override void OnSpawn(Spawner section)
 {
     //base.OnSpawn(section);
 }
 public Spawner(Spawner spawnerToCopy)
 {
     m_owner     = spawnerToCopy.m_owner;
     m_gene      = new Gene(spawnerToCopy.m_gene);
     m_spawnArea = spawnerToCopy.m_spawnArea;
 }
 public override void OnSpawn(Spawner section)
 {
 }