Esempio n. 1
0
        protected override void PerformCustomInitialization()
        {
            GameObject camera = new GameObject();

            camera.AddComponent(new Camera());
            camera.AddComponent(new NoisePrinter());
            camera.AddComponent(new EngineCore.Behaviours.CameraMovementController());
            new GameObject().AddComponent <FpsTracker>();
            Chunk chunk = new ChunkGenerator().GenerateChunk(.9f);

            Debug.WriteLine(chunk.GetChunkDataAtCoordinate(5, 5, 5).BlockType);
            Debug.WriteLine(SimplexNoise.GenerateSimplexNoiseWithOctaves(5, 0, 0, 0));
            Debug.WriteLine(SimplexNoise.GenerateSimplexNoiseWithOctaves(5, 5, -10, 1));
            Debug.WriteLine(SimplexNoise.GenerateSimplexNoiseWithOctaves(5, 7, 5, 2));

            for (int x = 0; x < Chunk.ChunkWidth; x++)
            {
                for (int y = 0; y < Chunk.ChunkHeight; y++)
                {
                    for (int z = 0; z < Chunk.ChunkDepth; z++)
                    {
                        var pointData = chunk.GetChunkDataAtCoordinate(x, y, z);
                        if (pointData.BlockType == BlockType.Stone)
                        {
                            var box = GameObject.CreateStaticBox(1.0f, 1.0f, 1.0f);
                            box.Transform.Position = new System.Numerics.Vector3(x, y, z);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        protected override void PerformCustomInitialization()
        {
            GameObject camera = new GameObject();
            camera.AddComponent(new Camera());
            camera.AddComponent(new NoisePrinter());
            camera.AddComponent(new EngineCore.Behaviours.CameraMovementController());
            new GameObject().AddComponent<FpsTracker>();
            Chunk chunk = new ChunkGenerator().GenerateChunk(.9f);
            Debug.WriteLine(chunk.GetChunkDataAtCoordinate(5, 5, 5).BlockType);
            Debug.WriteLine(SimplexNoise.GenerateSimplexNoiseWithOctaves(5, 0, 0, 0));
            Debug.WriteLine(SimplexNoise.GenerateSimplexNoiseWithOctaves(5, 5, -10, 1));
            Debug.WriteLine(SimplexNoise.GenerateSimplexNoiseWithOctaves(5, 7, 5, 2));

            for (int x = 0; x < Chunk.ChunkWidth; x++)
            {
                for (int y = 0; y < Chunk.ChunkHeight; y++)
                {
                    for (int z = 0; z < Chunk.ChunkDepth; z++)
                    {
                        var pointData = chunk.GetChunkDataAtCoordinate(x, y, z);
                        if (pointData.BlockType == BlockType.Stone)
                        {
                            var box = GameObject.CreateStaticBox(1.0f, 1.0f, 1.0f);
                            box.Transform.Position = new System.Numerics.Vector3(x, y, z);
                        }
                    }
                }
            }
        }