Пример #1
0
        public void Create(ClassicGame game)
        {
            var gamdat = new Burntime.Data.BurnGfx.Save.SaveGame();

            gamdat.Open();
            LogicFactory.SetParameter("gamdat", gamdat);
        }
Пример #2
0
        public void CreateNewGame(NewGameInfo Info)
        {
            new LogicFactory();

            // load game settings
            settings = new GameSettings("gamesettings.txt");
            settings.SetDifficulty(Info.Difficulty);

            // set up game server
            SetupServer();

            // get root game object
            ClassicGame game = container.Root as ClassicGame;

            LogicFactory.SetParameter("resource", app.ResourceManager);

            // open gam.dat
            IGameObjectCreator creator = new ClassicBurnGfxCreator();

            creator.Create(game);
            var gamdat = LogicFactory.GetParameter <Burntime.Data.BurnGfx.Save.SaveGame>("gamdat");

            // create world object
            game.World = container.Create <ClassicWorld>();
            game.World.VictoryCondition = container.Create <VictoryCondition>();

            // set difficulty
            game.World.Difficulty = Info.Difficulty;

            // add player objects
            AddPlayer(game, Info, gamdat, settings);

            // set main map
            game.World.Map = container.Create <Map>(new object[] { "maps/mat_000.burnmap" });
            LogicFactory.SetParameter("mainmap", game.World.Map);
            game.World.Ways = container.Create <Ways>(new object[] { "ways@maps/mat_000-ways.txt" });

            // set constructions
            game.Constructions = (Constructions)app.ResourceManager.GetData("*****@*****.**");
            game.ItemTypes     = container.Create <ItemTypes>(new object[] { "*****@*****.**" });

            // set productions
            LoadProductions(game, gamdat);

            // create respawn class
            game.World.Respawn = container.Create <CharacterRespawn>(new object[] { settings.Respawn.NPC, settings.Respawn.Trader,
                                                                                    settings.Respawn.Mutant, settings.Respawn.Dog });

            // create locations
            creator = new OriginalLocationCreator();
            creator.Create(game);
            creator = new LocationCreator();
            creator.Create(game);

            // place npcs
            LoadNPCs(game, gamdat);

            // set start locations for player
            SetStartLocations(game);

            // place items
            LoadItems(game, gamdat);

            // set trader
            LoadTrader(game, gamdat);

            // set start inventory for player
            SetStartInventory(game);

            container.Synchronize(false); // DEBUG

            app.Server.Run();
        }