Пример #1
0
        TimeSpan _tillNextSpawn; //how long till spawning a new enemy

        #endregion Fields

        #region Constructors

        public Wave(WaveData data, bool trickleWave)
        {
            string[] enemyNames = data.EnemyNames;
            _enemies = new Enemy[enemyNames.Length];
            for (int j = 0; j < _enemies.Length; j++)
            {
                _enemies[j] = new Enemy(enemyNames[j]);
            }
            _numEnemies = _enemies.Length;
            _spawnedSoFar = 0;
            _tillNextSpawn = data.SpawnInterval;
            _spawnInterval = data.SpawnInterval;
            _startTimer = data.StartTime;
            _isTrickleWave = trickleWave;
            _spawnLocation = Vector2.Zero;
            //activation delay is zero for trickle waves
            _activationDelay = _isTrickleWave ? TimeSpan.Zero : TimeSpan.FromSeconds((double)ACTIVATION_DELAY_SECONDS);
            //assign a portal particle effect if it is a burst wave
            _portalEffect = (trickleWave) ? null : new ParticleEffect(PORTAL_EFFECT_NAME1);
        }
Пример #2
0
 public Wave(WaveData data, bool trickleWave, Rectangle levelBounds)
 {
     _enemies = data.Enemies == null ? new Enemy[0] : new Enemy[data.Enemies.Length];
     _obstacles = data.Obstacles == null ? new Obstacle[0] : new Obstacle[data.Obstacles.Length];
     _bodies = new PhysicalBody[_enemies.Length + _obstacles.Length];
     _numEnemies = _enemies.Length;
     for (int j = 0; j < data.Enemies.Length; j++)
     {
         _enemies[j] = new Enemy(data.Enemies[j], levelBounds);
         _bodies[j] = _enemies[j];
     }
     for (int j = 0; j < _obstacles.Length; j++)
     {
         _obstacles[j] = new Obstacle(data.Obstacles[j]);
         _bodies[j + _numEnemies] = _obstacles[j];
     }
     _enemySpawnRate = data.EnemySpawnRate;
     _enemySpawnIndex = 0;
     _enemySpawnValue = 0;
     _spawnLocation = Vector2.Zero;
     SpawnEnable = true;
     _levelBounds = levelBounds;
 }