private void AddLevelTerrain(Scene scene) { for (int x = 15; x <= 20; x++) { for (int y = 15; y <= 20; y++) { for (int z = 1; z < 5; z++) { var block = new Block(scene.CreateChild()); block.Location = new Vector3(x * 5, (z * 5) + 50, y * 5); var box = block.BlockNode.CreateComponent <Box>(); if ((z == 1 + 50 || z == 2 + 50) && (x == 17 + 50 || x == 18 + 50)) { box.SetMaterial(Texture.OakPanel); } else { box.SetMaterial(Texture.Brick); } ListOfStaticBlocks.Add(block.Location, block); } } } }
private void AddLevelFoundation(Scene scene) { for (int x = 0; x < 50; x++) { for (int y = 0; y < 50; y++) { var block = new Block(scene.CreateChild()); block.Location = new Vector3(x * 5, 50, y * 5); var box = block.BlockNode.CreateComponent <Box>(); if (x == 17 || x == 18) { box.SetMaterial(Texture.Grass); } else { box.SetMaterial(Texture.BlackStone); } ListOfStaticBlocks.Add(block.Location, block); } } }
private void CreateBoxes(Scene scene) { // Create randomly sized boxes. If boxes are big enough, make them occluders uint numBoxes = 15; const float size = 5f; for (uint i = 0; i < numBoxes; ++i) { var block = new Block(scene.CreateChild()); do { block.Location = new Vector3(NextRandom(i) * size, size + 50, NextRandom(i) * size); }while (ListOfStaticBlocks.ContainsKey(block.Location)); var box = block.BlockNode.CreateComponent <Box>(); box.SetMaterial(Texture.WoodPanel); ListOfStaticBlocks.Add(block.Location, block); } numBoxes += 20; for (uint i = 14; i < numBoxes; ++i) { var block = new Block(scene.CreateChild()); do { block.Location = new Vector3(NextRandom(i) * size, size + 50, NextRandom(i) * size); }while (ListOfStaticBlocks.ContainsKey(block.Location)); var box = block.BlockNode.CreateComponent <Box>(); box.SetMaterial(Texture.LightWood); ListOfStaticBlocks.Add(block.Location, block); } numBoxes = 15; for (uint i = 0; i < numBoxes; ++i) { var block = new Block(scene.CreateChild()); do { block.Location = new Vector3(NextRandom(i) * size, size + 50, NextRandom(i) * size); }while (ListOfStaticBlocks.ContainsKey(block.Location)); var box = block.BlockNode.CreateComponent <Box>(); box.SetMaterial(Texture.OakPanel); ListOfStaticBlocks.Add(block.Location, block); } numBoxes += 20; for (uint i = 14; i < numBoxes; ++i) { var block = new Block(scene.CreateChild()); do { block.Location = new Vector3(NextRandom(i) * size, size + 50, NextRandom(i) * size); }while (ListOfStaticBlocks.ContainsKey(block.Location)); var box = block.BlockNode.CreateComponent <Box>(); box.SetMaterial(Texture.DarkWood); ListOfStaticBlocks.Add(block.Location, block); } }