/// <summary> /// Queues up a wave of enemies per player on the sides of the screen. /// </summary> /// <param name="enemyType"> The type of enemy to spawn.</param> /// <param name="playerSpecifc">If true, each spawn can only be damaged by the player who shares a /// colour with it.</param> void SidesWave(EnemyType enemyType, bool playerSpecifc) { ICollection <IGenerator> wave; SideGenerator g; int[] sides = { 0, 1, 2, 3 }; shuffle(sides); foreach (MainGun p in model.ActivePlayers) { wave = new LinkedList <IGenerator>(); g = new SideGenerator(sides[p.PlayerId], 1 + random.Next(1 + LinearDifficulty(50, 3))); g.EnemyHealth = 1 + LinearDifficulty(5, 0); g.EnemySize = 20; g.EnemySizeVariance = LinearDifficulty(5, 10); g.EnemyType = enemyType; g.Frequency = model.Music.ClicksPerBeat; g.GroupSize = 2 + LinearDifficulty(8, 10); g.MultiplayerAdjustment = 0; if (playerSpecifc) { g.PlayerSpecific = true; } wave.Add(g); waves.Enqueue(wave); } }
/// <summary> /// Chooses a random generator type and enemy type per player and queues them. /// </summary> /// <param name="useAllSides">False if only each player's own side should be used to spawn, true if /// there should be a chance of using a random side.</param> /// <param name="playerSpecifc">If true, each spawn can only be damaged by the player who shares a /// colour with it.</param> void RandomWave(bool useAllSides, bool playerSpecifc) { ICollection <IGenerator> wave = new LinkedList <IGenerator>(); AbstractGenerator g; foreach (MainGun p in model.ActivePlayers) { int side = p.PlayerId; // If useAllSides, sometimes choose a different side. if (useAllSides && random.Next(2) == 0) { side = random.Next(0, 3); } //Choose the type of generator. int genType = random.Next(3); switch (genType) { case 0: g = new CircleGenerator(1); g.GroupSize = 20; g.MultiplayerAdjustment = 1; System.Console.WriteLine(0); break; case 1: g = new PointGenerator(PointGenerator.PointOnSide(side, 20), 3 + LinearDifficulty(10, 12)); System.Console.WriteLine(1); break; case 2: g = new SideGenerator(side, 1); g.GroupSize = 20; g.MultiplayerAdjustment = 1; System.Console.WriteLine(2); break; default: throw new InvalidOperationException(); } //Choose the type of enemy. int enemyType = random.Next(3); switch (enemyType) { case 0: g.EnemyType = EnemyType.Regular; break; case 1: g.EnemyType = EnemyType.Spiral; break; case 2: g.EnemyType = EnemyType.Wave; break; default: throw new InvalidOperationException(); } g.EnemyHealth = 1 + LinearDifficulty(5, 0); g.EnemySize = 20; g.EnemySizeVariance = LinearDifficulty(5, 10); g.Frequency = model.Music.ClicksPerBeat; if (playerSpecifc) { g.PlayerSpecific = true; } wave.Add(g); } waves.Enqueue(wave); }