private void SpawnEnemy(EnemyPath path)
        {
            Enemy e = new Enemy(_tileSheet.SpriteAnimation(), path[0]);

            e.AddPath(path);
            _enemies.Add(e);

            e.ShotFired += EnemyShotFired;
            e.OnDestroy += HandleOnEnemyDestroy;
        }
        private void UpdateNextWaveTimer(GameTime gameTime)
        {
            _nextWaveTimer.Update(gameTime);

            if (_nextWaveTimer.Completed)
            {
                int       pathIndex = _rand.Next(0, _paths.Count);
                EnemyPath path      = _paths[pathIndex];
                SpawnWave(path);
                _nextWaveTimer.Reset();
            }
        }
        private void SetupWayPoints()
        {
            // f*****g hard coded bullshit....
            EnemyPath path0 = new EnemyPath();

            path0.AddWayPoint(new Vector2(850, 300));
            path0.AddWayPoint(new Vector2(-100, 300));
            _paths.Add(path0);

            EnemyPath path1 = new EnemyPath();

            path1.AddWayPoint(new Vector2(-50, 225));
            path1.AddWayPoint(new Vector2(850, 225));
            _paths.Add(path1);

            EnemyPath path2 = new EnemyPath();

            path2.AddWayPoint(new Vector2(-100, 50));
            path2.AddWayPoint(new Vector2(150, 50));
            path2.AddWayPoint(new Vector2(200, 75));
            path2.AddWayPoint(new Vector2(200, 125));
            path2.AddWayPoint(new Vector2(150, 150));
            path2.AddWayPoint(new Vector2(150, 175));
            path2.AddWayPoint(new Vector2(200, 200));
            path2.AddWayPoint(new Vector2(600, 200));
            path2.AddWayPoint(new Vector2(850, 600));
            _paths.Add(path2);

            EnemyPath path3 = new EnemyPath();

            path3.AddWayPoint(new Vector2(600, -100));
            path3.AddWayPoint(new Vector2(600, 250));
            path3.AddWayPoint(new Vector2(580, 275));
            path3.AddWayPoint(new Vector2(500, 250));
            path3.AddWayPoint(new Vector2(500, 200));
            path3.AddWayPoint(new Vector2(450, 175));
            path3.AddWayPoint(new Vector2(400, 150));
            path3.AddWayPoint(new Vector2(-100, 150));
            _paths.Add(path3);
        }
Example #4
0
 public void AddPath(EnemyPath path) => _wayPoints.EnqueueRange(path.WayPoints);
 private void SpawnWave(EnemyPath path)
 {
     // add enemies to number of enemies to be spawned on
     // a particular path
     path.NumberOfEnemiesAvailable += _rand.Next(MinEnemiesPerWave, MaxEnemiesPerWave + 1);
 }