public void LoadContent() { //load the default stuff Zihao = new HenryPlayer(RNSEB.cm, this, 20, new Vector2(600, 600), new Vector2(0, 0), 0.9999999999999f); Notus = new HenryBoss(RNSEB.cm, this, 100, new Vector2(200, 300), new Vector2(0, 0), 0.8f); ships.Add(Notus); ships.Add(Zihao); ZihaoWepBar = new WeaponBar(); NotusWepBar = new WeaponBar(); if (BossMode) { if (!MultiMode) { Zihao.Automated = true; } ZihaoShieldBar = new ProgressBar(RNSEB.cm, new Rectangle(0, 0, (int)RNSEB.RESOLUTION.X, 20), "ShieldTick"); NotusHealthBar = new ProgressBar(RNSEB.cm, new Rectangle(0, (int)RNSEB.RESOLUTION.Y - 20, (int)RNSEB.RESOLUTION.X, 20), "HealthTick"); ZihaoWepBar.Position = new Vector2(RNSEB.RESOLUTION.X - 96, 6+22); NotusWepBar.Position = new Vector2(6, RNSEB.RESOLUTION.Y - (45+6+22)); NotusWepBar.SelectorVisible = true; } else { if (!MultiMode) { Notus.Automated = true; } ZihaoShieldBar = new ProgressBar(RNSEB.cm, new Rectangle(0, (int)RNSEB.RESOLUTION.Y - 20, (int)RNSEB.RESOLUTION.X, 20), "ShieldTick"); NotusHealthBar = new ProgressBar(RNSEB.cm, new Rectangle(0, 0, (int)RNSEB.RESOLUTION.X, 20), "HealthTick"); ZihaoWepBar.Position = new Vector2(RNSEB.RESOLUTION.X - 96, RNSEB.RESOLUTION.Y - 70); NotusWepBar.Position = new Vector2(6, 12+22); } ZihaoShieldBar.TickRotation = (float)Math.PI / 16.0f; ZihaoShieldBar.QuantityMax = Zihao.ShieldMax; ZihaoShieldBar.ShowValue = true; ZihaoShieldBar.ShowBorder = true; ZihaoShieldBar.ValueAccuracy = 1; NotusHealthBar.QuantityMax = Notus.HealthMax; NotusHealthBar.ShowValue = true; NotusHealthBar.ShowBorder = true; ZihaoWepBar.AddWeapon(Zihao.FocusedWeapon); NotusWepBar.AddWeapon(Notus.LaunchBays[0]); }
// Here lies the code of Parker Leech, noble warrior, protector of all. // He fought valiantly 'til the last, though in the end the Git was too mighty a foe. protected HenryBattlefield(SerializationInfo info, StreamingContext context) { BossMode = info.GetBoolean("BossMode"); ships = (List<HenrySpawner>)info.GetValue("ships", typeof(List<HenrySpawner>)); background = (HenrySprite)info.GetValue("background", typeof(HenrySprite)); Zihao = (HenryPlayer)info.GetValue("Zihao", typeof(HenryPlayer)); Notus = (HenryBoss)info.GetValue("Notus", typeof(HenryBoss)); LevelNumber = (int)info.GetValue("LevelNumber", typeof(int)); NotusHealthBar = (ProgressBar)info.GetValue("NotusHealthBar", typeof(ProgressBar)); ZihaoShieldBar = (ProgressBar)info.GetValue("ZihaoShieldBar", typeof(ProgressBar)); NotusWepBar = (WeaponBar)info.GetValue("NotusWepBar", typeof(WeaponBar));//has sprites ZihaoWepBar = (WeaponBar)info.GetValue("ZihaoWepBar", typeof(WeaponBar));//has sprites background.ReloadContent(); NotusHealthBar.text.ReloadContent("Button"); ZihaoShieldBar.text.ReloadContent("Button"); //Console.WriteLine("ships not null"); foreach (HenrySpawner hs in ships)//is this part of the problem { // Console.WriteLine("bout to reload ship"); hs.ReloadContent();//the problem is here // don't think th cm really is doing anything, probably remove it later if (hs is HenryPlayer) { foreach (HenryBullet b in ((HenryPlayer)hs).FocusedWeapon.bullets) b.ReloadContent(); foreach (HenryBullet b in ((HenryPlayer)hs).DiffuseWeapon.bullets) b.ReloadContent(); } else if (hs is HenryBoss) { foreach (LaunchBay lb in ((HenryBoss)hs).LaunchBays) foreach (HenrySpawner sh in lb.spawners) foreach (HenryBullet B in sh.FocusedWeapon.bullets) B.ReloadContent(); foreach (HenryWeapon hw in ((HenryBoss)hs).ExtraWeapons) foreach (HenryBullet B in hw.bullets) B.ReloadContent(); } else foreach (HenryBullet B in hs.FocusedWeapon.bullets) B.ReloadContent(); } Zihao.ReloadContent(); ZihaoWepBar.selectorSquare.ReloadContent(); NotusWepBar.selectorSquare.ReloadContent(); foreach (WeaponIndicator wi in NotusWepBar.Weapons) { wi.icon.ReloadContent(); wi.chargeBar.tick.ReloadContent(); wi.chargeBar.borderPixel.ReloadContent(); wi.text.ReloadContent("Button"); } foreach (WeaponIndicator wi in ZihaoWepBar.Weapons) { wi.icon.ReloadContent(); wi.chargeBar.tick.ReloadContent(); wi.chargeBar.borderPixel.ReloadContent(); wi.text.ReloadContent("Button"); } ZihaoShieldBar.tick.ReloadContent(); ZihaoShieldBar.borderPixel.ReloadContent(); NotusHealthBar.tick.ReloadContent(); NotusHealthBar.borderPixel.ReloadContent(); Notus.ReloadContent(); Notus.staticFieldSprite.ReloadContent(); }
//send data over network (in order) for boss private void SendDataBoss(HenryBoss boss, GameTime gameTime) { foreach (LocalNetworkGamer gamer in networkSession.LocalGamers) { RecieveRemoteData(gamer, gameTime); packetWriter.Write(boss.acceleration); packetWriter.Write(boss.Position); /*for (int i = 0; i < TheBattlefield.Notus.LaunchBays.Count; i++) { packetWriter.Write(TheBattlefield.Notus.LaunchBays[i].); }*/ if (RNSEB.Input.GetKey("BossFire1")) { packetWriter.Write(true); } else packetWriter.Write(false); if (RNSEB.Input.GetKey("BossFire2")) { packetWriter.Write(true); } else packetWriter.Write(false); gamer.SendData(packetWriter, SendDataOptions.InOrder); } }