示例#1
0
    public void LoadWorld(int n)
    {
        if (System.IO.File.Exists(GetWorldFilePath(n)))
        {
            gameManagerUnity.DestroyWorld();

            AvailableConfigurations configurations = GameManagerUnity.LoadConfiguration();

            gameManagerUnity.LoadCustomTextures();

            byte[] data = System.IO.File.ReadAllBytes(GetWorldFilePath(n));

            CubeWorld.Configuration.Config config = new CubeWorld.Configuration.Config();
            config.tileDefinitions = configurations.tileDefinitions;
            config.itemDefinitions = configurations.itemDefinitions;
            config.avatarDefinitions = configurations.avatarDefinitions;
            config.extraMaterials = configurations.extraMaterials;

            gameManagerUnity.extraMaterials = config.extraMaterials;

            gameManagerUnity.world = new CubeWorld.World.CubeWorld(gameManagerUnity.objectsManagerUnity, gameManagerUnity.fxManagerUnity);
            gameManagerUnity.world.Load(config, data);
            worldGeneratorProcess = null;

            gameManagerUnity.surroundingsUnity.CreateSurroundings(gameManagerUnity.world.configSurroundings);

            gameManagerUnity.State = GameManagerUnity.GameManagerUnityState.GENERATING;
        }
    }
示例#2
0
    public void JoinMultiplayerGame(string server, int port)
    {
        gameManagerUnity.DestroyWorld();

        worldGeneratorProcess = new GeneratorProcess(new MultiplayerGameLoaderGenerator(this, server, port), null);

        gameManagerUnity.State = GameManagerUnity.GameManagerUnityState.GENERATING;
    }
    public void CreateRandomWorld(CubeWorld.Configuration.Config config)
    {
        gameManagerUnity.DestroyWorld();

        gameManagerUnity.LoadCustomTextures();

        gameManagerUnity.extraMaterials = config.extraMaterials;

        gameManagerUnity.world = new CubeWorld.World.CubeWorld(gameManagerUnity.objectsManagerUnity, gameManagerUnity.fxManagerUnity);
        worldGeneratorProcess  = gameManagerUnity.world.Generate(config);

        gameManagerUnity.surroundingsUnity.CreateSurroundings(gameManagerUnity.world.configSurroundings);

        gameManagerUnity.State = GameManagerUnity.GameManagerUnityState.GENERATING;
    }
    public void CreateRandomWorld(CubeWorld.Configuration.Config config)
    {
        gameManagerUnity.DestroyWorld();

        gameManagerUnity.LoadCustomTextures();

        gameManagerUnity.extraMaterials = config.extraMaterials;

        gameManagerUnity.world = new CubeWorld.World.CubeWorld(gameManagerUnity.objectsManagerUnity, gameManagerUnity.fxManagerUnity);
        worldGeneratorProcess = gameManagerUnity.world.Generate(config);

        gameManagerUnity.surroundingsUnity.CreateSurroundings(gameManagerUnity.world.configSurroundings);

        gameManagerUnity.State = GameManagerUnity.GameManagerUnityState.GENERATING;
    }
    public void JoinMultiplayerGame(string server, int port)
    {
        gameManagerUnity.DestroyWorld();

        worldGeneratorProcess = new GeneratorProcess(new MultiplayerGameLoaderGenerator(this, server, port), null);

        gameManagerUnity.State = GameManagerUnity.GameManagerUnityState.GENERATING;
    }