Example #1
0
        public void initialize(bool restarting)
        {
            Console.WriteLine("Initializing...");
            gameStatus = GameStatus.LOADING;
            TCODConsole.initRoot(screenWidth, screenHeight, "Janus Roguelike", false);

            TCODMouse.showCursor(true);

            menuGui = new GUI.MenuGui(screenWidth, screenHeight);

            levels = new Dictionary <int, Level>();

            gui        = new GUI.Gui();
            loadingGui = new GUI.LoadingGui();
            messageGui = new GUI.MessageGui();
            defeatGui  = new GUI.DefeatGui();
            debugCommands.initialize(this);

            levels.Add(FIRST_LEVEL, new Level());

            levelnr = FIRST_LEVEL;
            //currentLevel = new Level();
            if (FIRST_LEVEL == int.MaxValue)
            {
                currentLevel.initialize(restarting, FIRST_LEVEL, typeof(Generators.TestLevelGenerator));
            }
            else
            {
                currentLevel.initialize(restarting, FIRST_LEVEL);
            }

            changeLevel(FIRST_LEVEL);

            player = new Player();
            player.getDestructible().ressurect();

            player.x = map.startx; //assign player position
            player.y = map.starty;

            player.fov.update();
            if (actorHandler.getActor(0) != null)
            {
                actorHandler.actors.Remove(actorHandler.getActor(0));
            }
            actorHandler.addActor(player);

            Saver.load();

            Console.WriteLine("Initializing Complete");


            render();

            lastKey    = new TCODKey();
            gameStatus = GameStatus.STARTUP;
        }
Example #2
0
        public void load()
        {
            levelnr = _levelnr;
            menuGui = new GUI.MenuGui(screenWidth, screenHeight);

            debugCommands.initialize(this);
            //currentLevel =
            foreach (Level level in levels.Values)
            {
                level.load();
            }
            player     = (Player)currentLevel.actorHandler.getActor(0);
            gameStatus = GameStatus.STARTUP;
        }