private void CreateBGItem(Rectangle r, float zdepth, ref BackgroundItem neb)
 {
     neb.UpperLeft = new Vector3((float)r.X, (float)r.Y, zdepth);
     neb.LowerLeft = neb.UpperLeft + new Vector3(0f, (float)r.Height, 0f);
     neb.UpperRight = neb.UpperLeft + new Vector3((float)r.Width, 0f, 0f);
     neb.LowerRight = neb.UpperLeft + new Vector3((float)r.Width, (float)r.Height, 0f);
     neb.FillVertices();
 }
 public DimensionalPrison(Vector2 Position)
 {
     this.p1 = Position + new Vector2(0f, -400f);
     this.p2 = Position + new Vector2(-400f, 400f);
     this.p3 = Position + new Vector2(400f, 400f);
     this.s1 = ResourceManager.CreateShipAtPoint(this.PlatformName, EmpireManager.GetEmpireByName("Unknown"), this.p1);
     this.s2 = ResourceManager.CreateShipAtPoint(this.PlatformName, EmpireManager.GetEmpireByName("Unknown"), this.p2);
     this.s3 = ResourceManager.CreateShipAtPoint(this.PlatformName, EmpireManager.GetEmpireByName("Unknown"), this.p3);
     this.Position = Position;
     Rectangle r = new Rectangle((int)Position.X - 200, (int)Position.Y - 200, 400, 400);
     this.Prison = new BackgroundItem();
     this.Prison.LoadContent(Anomaly.screen.ScreenManager, Anomaly.screen.view, Anomaly.screen.projection);
     this.Prison.UpperLeft = new Vector3((float)r.X, (float)r.Y, 0f);
     this.Prison.LowerLeft = this.Prison.UpperLeft + new Vector3(0f, (float)r.Height, 0f);
     this.Prison.UpperRight = this.Prison.UpperLeft + new Vector3((float)r.Width, 0f, 0f);
     this.Prison.LowerRight = this.Prison.UpperLeft + new Vector3((float)r.Width, (float)r.Height, 0f);
     this.Prison.Texture = ResourceManager.TextureDict["Textures/star_neutron"];
     this.Prison.FillVertices();
     this.b1 = new Beam(this.p1, Position, 50, this.s1)
     {
         weapon = ResourceManager.WeaponsDict["AncientRepulsor"]
     };
     this.b1.LoadContent(Anomaly.screen.ScreenManager, Anomaly.screen.view, Anomaly.screen.projection);
     this.s1.Beams.Add(this.b1);
     this.b1.infinite = true;
     this.b1.range = 2500f;
     this.b1.thickness = 75;
     this.b1.PowerCost = 0f;
     this.b1.damageAmount = 0f;
     this.b2 = new Beam(this.p2, Position, 50, this.s2)
     {
         weapon = ResourceManager.WeaponsDict["AncientRepulsor"]
     };
     this.b2.LoadContent(Anomaly.screen.ScreenManager, Anomaly.screen.view, Anomaly.screen.projection);
     this.b2.infinite = true;
     this.s2.Beams.Add(this.b2);
     this.b2.range = 2500f;
     this.b2.thickness = 75;
     this.b2.PowerCost = 0f;
     this.b2.damageAmount = 0f;
     this.b3 = new Beam(this.p3, Position, 50, this.s3)
     {
         weapon = ResourceManager.WeaponsDict["AncientRepulsor"]
     };
     this.b3.LoadContent(Anomaly.screen.ScreenManager, Anomaly.screen.view, Anomaly.screen.projection);
     this.b3.infinite = true;
     this.s3.Beams.Add(this.b3);
     this.b3.range = 2500f;
     this.b3.thickness = 75;
     this.b3.PowerCost = 0f;
     this.b3.damageAmount = 0f;
 }
 private void CreateBlackClouds()
 {
     BackgroundItem BigNeb_1 = new BackgroundItem()
     {
         Texture = ResourceManager.TextureDict["hqspace/neb_black_1"]
     };
     Vector2 nebUpperLeft = Vector2.Zero;
     float zPos = 50000f;
     float xSize = RandomMath.RandomBetween(1000000f, 1100000f);
     float ySize = (float)(BigNeb_1.Texture.Height / BigNeb_1.Texture.Width) * xSize;
     BigNeb_1.UpperLeft = new Vector3(nebUpperLeft, zPos);
     BigNeb_1.LowerLeft = BigNeb_1.UpperLeft + new Vector3(0f, ySize, 0f);
     BigNeb_1.UpperRight = BigNeb_1.UpperLeft + new Vector3(xSize, 0f, 0f);
     BigNeb_1.LowerRight = BigNeb_1.UpperLeft + new Vector3(xSize, ySize, 0f);
     BigNeb_1.FillVertices();
     BigNeb_1.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.NonAdditiveList.Add(BigNeb_1);
 }
 private void CreateRandomSmallObject()
 {
     BackgroundItem BigNeb_1 = new BackgroundItem()
     {
         Texture = ResourceManager.SmallNebulas[(int)RandomMath.RandomBetween(0f, (float)ResourceManager.SmallNebulas.Count)]
     };
     Vector2 nebUpperLeft = new Vector2(RandomMath.RandomBetween(-800000f, 8000000f), RandomMath.RandomBetween(-800000f, 8000000f));
     float zPos = (float)RandomMath.RandomBetween(200000f, 2500000f);
     float xSize = RandomMath.RandomBetween(800000f, 1800000f);
     float ySize = (float)(BigNeb_1.Texture.Height / BigNeb_1.Texture.Width) * xSize;
     BigNeb_1.UpperLeft = new Vector3(nebUpperLeft, zPos);
     BigNeb_1.LowerLeft = BigNeb_1.UpperLeft + new Vector3(0f, ySize, 0f);
     BigNeb_1.UpperRight = BigNeb_1.UpperLeft + new Vector3(xSize, 0f, 0f);
     BigNeb_1.LowerRight = BigNeb_1.UpperLeft + new Vector3(xSize, ySize, 0f);
     BigNeb_1.FillVertices();
     BigNeb_1.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(BigNeb_1);
     BackgroundItem BigNeb_2 = new BackgroundItem()
     {
         Texture = ResourceManager.SmallNebulas[(int)RandomMath.RandomBetween(0f, (float)ResourceManager.SmallNebulas.Count)]
     };
     zPos = zPos + 200000f;
     xSize = RandomMath.RandomBetween(800000f, 1800000f);
     ySize = (float)(BigNeb_1.Texture.Height / BigNeb_1.Texture.Width) * xSize;
     BigNeb_2.UpperLeft = new Vector3(nebUpperLeft, zPos);
     BigNeb_2.LowerLeft = BigNeb_1.UpperLeft + new Vector3(0f, ySize, 0f);
     BigNeb_2.UpperRight = BigNeb_1.UpperLeft + new Vector3(xSize, 0f, 0f);
     BigNeb_2.LowerRight = BigNeb_1.UpperLeft + new Vector3(xSize, ySize, 0f);
     BigNeb_2.FillVertices();
     BigNeb_2.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(BigNeb_2);
     BackgroundItem BigNeb_3 = new BackgroundItem()
     {
         Texture = ResourceManager.SmallNebulas[(int)RandomMath.RandomBetween(0f, (float)ResourceManager.SmallNebulas.Count)]
     };
     zPos = zPos + 200000f;
     xSize = RandomMath.RandomBetween(800000f, 1800000f);
     ySize = (float)(BigNeb_1.Texture.Height / BigNeb_1.Texture.Width) * xSize;
     BigNeb_3.UpperLeft = new Vector3(nebUpperLeft, zPos);
     BigNeb_3.LowerLeft = BigNeb_2.UpperLeft + new Vector3(0f, ySize, 0f);
     BigNeb_3.UpperRight = BigNeb_2.UpperLeft + new Vector3(xSize, 0f, 0f);
     BigNeb_3.LowerRight = BigNeb_2.UpperLeft + new Vector3(xSize, ySize, 0f);
     BigNeb_3.FillVertices();
     BigNeb_3.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(BigNeb_3);
 }
 private void CreateRandomLargeNebula(Rectangle r)
 {
     float startz = 3500000f;
     float zPos = 3500000f;
     Rectangle r1 = r;
     r1.X = r1.X + 1500000;
     r1.Y = r1.Y + 1000000;
     r1.Width = r1.Width - 2500000;
     r1.Height = r1.Height - 2500000;
     BackgroundItem pointy = new BackgroundItem()
     {
         Texture = ResourceManager.TextureDict["hqspace/neb_pointy"]
     };
     this.CreateBGItem(r1, zPos, ref pointy);
     pointy.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(pointy);
     zPos = zPos + 400000f;
     pointy = new BackgroundItem()
     {
         Texture = ResourceManager.BigNebulas[2]
     };
     this.CreateBGItem(r1, zPos, ref pointy);
     pointy.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(pointy);
     r1.X = r1.X - 750000;
     r1.Y = r1.Y + 500000;
     zPos = zPos - 400000f;
     BackgroundItem floaty = new BackgroundItem()
     {
         Texture = ResourceManager.TextureDict["hqspace/neb_floaty"]
     };
     this.CreateBGItem(r1, zPos, ref floaty);
     floaty.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(floaty);
     BackgroundItem BigNeb_1 = new BackgroundItem()
     {
         Texture = ResourceManager.MedNebulas[0]
     };
     this.CreateBGItem(r, zPos, ref BigNeb_1);
     BigNeb_1.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(BigNeb_1);
     zPos = zPos + 500000f;
     BackgroundItem BigNeb_2 = new BackgroundItem()
     {
         Texture = ResourceManager.MedNebulas[1]
     };
     this.CreateBGItem(r, zPos, ref BigNeb_2);
     BigNeb_2.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(BigNeb_2);
     zPos = zPos + 500000f;
     BackgroundItem BigNeb_3 = new BackgroundItem()
     {
         Texture = ResourceManager.BigNebulas[1]
     };
     this.CreateBGItem(r, zPos, ref BigNeb_3);
     BigNeb_3.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
     this.BGItems.Add(BigNeb_3);
     for (int i = 0; i < 50; i++)
     {
         BackgroundItem BigNeb_4 = new BackgroundItem()
         {
             Texture = ResourceManager.TextureDict["Textures/smoke"]
         };
         float rw = RandomMath.RandomBetween(150000f, 800000f);
         Rectangle b = new Rectangle((int)RandomMath.RandomBetween((float)r.X + (float)r.Width * 0.2f, (float)r.X + (float)r.Width * 0.6f), (int)RandomMath.RandomBetween((float)r.Y + (float)r.Height * 0.2f, (float)r.Y + (float)r.Height * 0.6f), (int)rw, (int)rw);
         float zed = RandomMath.RandomBetween(startz + 200000f, zPos + 250000f);
         this.CreateBGItem(b, zed, ref BigNeb_4);
         BigNeb_4.LoadContent(this.screen.ScreenManager, this.screen.view, this.screen.projection);
         this.BGItems.Add(BigNeb_4);
         this.screen.star_particles.AddParticleThreadB(new Vector3((float)(b.X + b.Width / 2), (float)(b.Y + b.Height / 2), zed), Vector3.Zero);
     }
 }
        protected void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    if (this.Prison != null)
                        this.Prison.Dispose();

                }
                this.Prison = null;
                this.disposed = true;
            }
        }