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(); }
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); }