public override void InitScreen(ScreenType screenType) { Texture2D image = GameContent.GameAssets.Images.NonPlayingObjects.Planet; Texture2D EMP = GameContent.GameAssets.Images.SecondaryWeapon[SecondaryWeaponType.EMP, TextureDisplayType.ShopDisplay]; Texture2D RayGun = GameContent.GameAssets.Images.SecondaryWeapon[SecondaryWeaponType.ShrinkRay, TextureDisplayType.ShopDisplay]; Texture2D Bomb = GameContent.GameAssets.Images.SecondaryWeapon[SecondaryWeaponType.SpaceMine, TextureDisplayType.ShopDisplay]; SpaceBucksAmount = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.GameAssets.Fonts.NormalText, string.Format("You have {0} credits", StateManager.SpaceBucks), Color.White); SpaceBucksAmount.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width / 2 - SpaceBucksAmount.Width, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f); AdditionalSprites.Add(SpaceBucksAmount); SpriteFont font = GameContent.GameAssets.Fonts.NormalText; //EMP EMP weapon1 = new EMP(EMP, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.6f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), Sprites.SpriteBatch); TextSprite text1 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nAn electro magnetic pulse. \nThis device disables all \nnearby enemy ships \nwithin your ship's range. \n\ncost: 1000 credits", Color.White); weapon1.Scale = new Vector2(0.5f, 0.5f); itemsShown.Add(weapon1); //Ray Gun ShrinkRay weapon2 = new ShrinkRay(RayGun, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.60f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.2f), Sprites.SpriteBatch); weapon2.Scale = new Vector2(0.5f, 0.5f); itemsShown.Add(weapon2); //Space Mine SpaceMine weapon3 = new SpaceMine(Bomb, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.69f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.3f), Sprites.SpriteBatch); weapon3.Scale = new Vector2(2f, 2f); itemsShown.Add(weapon3); TextSprite text2 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nThis weapon causes the targeted enemy\n to shrink losing 33% of their health. \nThis does not affect bosses.\n\ncost: 2000 credits", Color.White); TextSprite text3 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nYou place this mine anywhere in space \nand when an enemy crashes into it the mine \nexplodes \n\ncost: 500 credits.", Color.White); items.Add(new KeyValuePair <Sprite, TextSprite>(weapon2, text2)); items.Add(new KeyValuePair <Sprite, TextSprite>(weapon3, text3)); ChangeItem += new EventHandler(WeaponSelectScreen_ChangeItem); items.Add(new KeyValuePair <Sprite, TextSprite>(weapon1, text1)); base.InitScreen(screenType); acceptLabel.Text = "Buy"; //In clicked code this.nextButtonClicked += new EventHandler(WeaponSelectScreen_nextButtonClicked); }
//bool bought = false; public override void InitScreen(ScreenType screenType) { Shop.PurchaseScreenSelected += new EventHandler(Shop_PurchaseScreenSelected); Texture2D image = GameContent.Assets.Images.NonPlayingObjects.Planet; Texture2D EMP = GameContent.Assets.Images.SecondaryWeapon[SecondaryWeaponType.EMP, TextureDisplayType.ShopDisplay]; Texture2D RayGun = GameContent.Assets.Images.SecondaryWeapon[SecondaryWeaponType.ShrinkRay, TextureDisplayType.ShopDisplay]; Texture2D Bomb = GameContent.Assets.Images.SecondaryWeapon[SecondaryWeaponType.SpaceMine, TextureDisplayType.ShopDisplay]; Texture2D HealthPack = GameContent.Assets.Images.Equipment[EquipmentType.HealthPack, TextureDisplayType.ShopDisplay]; SpaceBucksAmount = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, string.Format("You have {0} credits", StateManager.SpaceBucks), Color.White); //SpaceBucksAmount.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width / 2 - SpaceBucksAmount.Width, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f); ItemAmount = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, string.Format("You have x{0} EMPs", StateManager.PowerUps[2].Count), Color.White); ItemAmount.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width / 2 - SpaceBucksAmount.Width, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .15f); AdditionalSprites.Add(SpaceBucksAmount); AdditionalSprites.Add(ItemAmount); SpriteFont font = GameContent.Assets.Fonts.NormalText; //EMP EMP weapon1 = new EMP(EMP, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.75f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.3f), Sprites.SpriteBatch); TextSprite text1 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nAn electro magnetic pulse. \nThis device disables all \nnearby enemy ships \nwithin your ship's range. \n\ncost: 1000 credits", Color.White); weapon1.Scale = new Vector2(0.5f, 0.5f); itemsShown.Add(weapon1); //Ray Gun ShrinkRay weapon2 = new ShrinkRay(RayGun, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.64f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.2f), Sprites.SpriteBatch); weapon2.Scale = new Vector2(0.5f, 0.5f); itemsShown.Add(weapon2); //Space Mine SpaceMine weapon3 = new SpaceMine(Bomb, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.69f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.3f), Sprites.SpriteBatch); weapon3.Scale = new Vector2(2f, 2f); itemsShown.Add(weapon3); TextSprite text2 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nThis weapon causes the targeted enemy\nto shrink losing 33% of their health. \nThis does not affect bosses.\n\ncost: 2000 credits", Color.White); TextSprite text3 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nYou place this mine anywhere in space \nand when an enemy crashes into it the mine \nexplodes \n\ncost: 500 credits.", Color.White); items.Add(new KeyValuePair<Sprite, TextSprite>(weapon2, text2)); items.Add(new KeyValuePair<Sprite, TextSprite>(weapon3, text3)); //HealthPack HealthPack weapon4 = new HealthPack(HealthPack, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.74f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.3f), Sprites.SpriteBatch); TextSprite text4 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.1f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 1.5f), font, "\n\n\nThis power up regenerates\nyour health up\nby 50%\n\nCost: " + weapon4.Cost, Color.White); text4.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.05f); weapon4.Scale = new Vector2(0.5f, 0.5f); items.Add(new KeyValuePair<Sprite, TextSprite>(weapon4, text4)); itemsShown.Add(weapon4); ChangeItem += new EventHandler(WeaponSelectScreen_ChangeItem); items.Add(new KeyValuePair<Sprite, TextSprite>(weapon1, text1)); base.InitScreen(screenType); acceptLabel.Text = "Buy"; //In clicked code this.nextButtonClicked += new EventHandler(WeaponSelectScreen_nextButtonClicked); }
//int weaponIndex = 0; public virtual void ShrinkRayShoot(ShrinkRay bulletShooter) { Bullet bullet = StateManager.BulletPool.GetBullet(); bullet.InitializePooledBullet(WorldCoords - new Vector2(Height * -DistanceToNose, Height * -DistanceToNose) * Rotation.Vector, this); bullet.SpriteBatch = WorldSb; //Shrink ray is always laser bullet.Texture = GameContent.Assets.Images.Ships.Bullets.Laser; bullet.Speed = Rotation.Vector * 3f; bullet.Rotation = Rotation; bullet.Damage = 0; bullet.Color = Color.White; bullet.MaximumDistance = new Vector2(100f); bulletShooter.ShotBullet = true; bulletShooter.ShrinkRayBullets.Add(bullet); }