Ejemplo n.º 1
0
        /// <summary>
        /// Starts
        /// </summary>
        public static void Startup(IntPtr _unmanagedModule)
        {
            // Get and save the resource domain of the mod, needed for loading resources.
            UpvoidMiner.Mod       = Module.FromHandle(_unmanagedModule);
            UpvoidMiner.ModDomain = UpvoidMiner.Mod.ResourceDomain;

            // Create the world. Multiple worlds could be created here, but we only want one.
            // Use the UpvoidMinerWorldGenerator, which will create a simple terrain with some vegetation.
            World world = Universe.CreateWorld("UpvoidMinerWorld");

            UpvoidMinerWorldGenerator.init(world);
            world.Start();

            for (int i = 0; i < 3; ++i)
            {
                TerrainResource mat = TerrainResource.FromName("Stone." + (i + 1).ToString("00"));
                Debug.Assert(mat != null, "Invalid material");
                MaterialItem testItem = new MaterialItem(mat, MaterialShape.Cube, new vec3(1), 1);

                world.AddEntity(new ItemEntity(testItem), mat4.Translate(new vec3(5f, i * 2f, ((i % 3) * 2f))));
            }
        }