public static void StartBossLevel() { for (int i = 0; i < 4; i++) { var normalV = new NormalVirus(); ((ISupportInitialize)(normalV)).BeginInit(); normalV.MouseClick += new MouseEventHandler(Game.instance.MouseClickShootBullet); normalV.BackColor = Color.Transparent; normalV.Parent = Game.instance.pbBackGround; normalV.DoubleBuffered = true; UiComponents.AddVirus(normalV); ((ISupportInitialize)(normalV)).EndInit(); } var shieldedV = new ShieldedVirus(); ((ISupportInitialize)(shieldedV)).BeginInit(); shieldedV.MouseClick += new MouseEventHandler(Game.instance.MouseClickShootBullet); shieldedV.BackColor = Color.Transparent; shieldedV.Parent = Game.instance.pbBackGround; shieldedV.DoubleBuffered = true; UiComponents.AddVirus(shieldedV); ((ISupportInitialize)(shieldedV)).EndInit(); }
public static void SpawnVirus() { string type = ""; if (UiComponents.Viruses.Count < 9) { type = VirusSpawnOrder[SpawnOrderIteration]; SpawnOrderIteration++; if (SpawnOrderIteration > VirusSpawnOrder.Count - 1) { SpawnOrderIteration = 0; } } if (type.Equals("nv")) { var normalV = new NormalVirus(); } if (type.Equals("sv")) { var shieldedV = new ShieldedVirus(); ((ISupportInitialize)(shieldedV)).BeginInit(); shieldedV.MouseClick += new MouseEventHandler(Game.instance.MouseClickShootBullet); shieldedV.BackColor = Color.Transparent; shieldedV.Parent = Game.instance.pbBackGround; shieldedV.DoubleBuffered = true; UiComponents.AddVirus(shieldedV); ((ISupportInitialize)(shieldedV)).EndInit(); } if (type.Equals("av")) { var aggroV = new AggroVirus(); ((ISupportInitialize)(aggroV)).BeginInit(); aggroV.MouseClick += new MouseEventHandler(Game.instance.MouseClickShootBullet); aggroV.BackColor = Color.Transparent; aggroV.Parent = Game.instance.pbBackGround; aggroV.DoubleBuffered = true; UiComponents.AddVirus(aggroV); ((ISupportInitialize)(aggroV)).EndInit(); } if (type.Equals("tv")) { var teleporterV = new TeleporterVirus(); ((ISupportInitialize)(teleporterV)).BeginInit(); teleporterV.MouseClick += new MouseEventHandler(Game.instance.MouseClickShootBullet); teleporterV.BackColor = Color.Transparent; teleporterV.Parent = Game.instance.pbBackGround; teleporterV.DoubleBuffered = true; UiComponents.AddVirus(teleporterV); ((ISupportInitialize)(teleporterV)).EndInit(); } if (DateTime.Now >= Game.instance.MutatedVirusSpawnTimer) { var mutatedV = new MutatedVirus(); ((ISupportInitialize)(mutatedV)).BeginInit(); mutatedV.MouseClick += new MouseEventHandler(Game.instance.MouseClickShootBullet); mutatedV.BackColor = Color.Transparent; mutatedV.Parent = Game.instance.pbBackGround; mutatedV.DoubleBuffered = true; UiComponents.AddVirus(mutatedV); ((ISupportInitialize)(mutatedV)).EndInit(); Game.instance.MutatedVirusSpawnTimer = Game.instance.MutatedVirusSpawnTimer.AddSeconds(25); } if (type.Equals("dv")) { var dividerV = new DividerVirus(); ((ISupportInitialize)(dividerV)).BeginInit(); dividerV.MouseClick += new MouseEventHandler(Game.instance.MouseClickShootBullet); dividerV.BackColor = Color.Transparent; dividerV.Parent = Game.instance.pbBackGround; dividerV.DoubleBuffered = true; UiComponents.AddVirus(dividerV); ((ISupportInitialize)(dividerV)).EndInit(); } }