Beispiel #1
0
 public bool CheckBlockLocationIsEmpty(Vector3 vector)
 {
     return(!ListOfStaticBlocks.ContainsKey(vector) && !ListOfCharacters.ContainsKey(vector));
 }
Beispiel #2
0
        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);
            }
        }