Exemple #1
0
        public Engine(State gameState, bool fromload = false, State newState = null)
        {
            TCODConsole.initRoot(Globals.WIDTH, Globals.HEIGHT, "roguelike", false);
            this.fromload = fromload;

            menu = new Menu();
            menu.clear();

            menu.add(Menu.MenuCode.NEW_GAME, "New Game");
            if (fromload)
            {
                menu.add(Menu.MenuCode.CONTINUE, "Continue");
            }
            menu.add(Menu.MenuCode.EXIT, "Exit");

            Menu.MenuCode selection = menu.pick();

            if (selection == Menu.MenuCode.EXIT)
            {
                Environment.Exit(0);
            }
            else if (selection == Menu.MenuCode.NEW_GAME)
            {
                try
                {
                    File.Delete(Globals.SAVE);
                } catch (IOException e)
                    {
                        System.Diagnostics.Debug.WriteLine(e.Message);
                    }
                fromload = false;
                if (newState == null)
                {
                    this.gameState = gameState;
                }
                else
                {
                    this.gameState = newState;
                }
            }
            else
            {
                this.gameState = gameState;
            }

            this.gStatus = Status.START;

            player = new Actor(40, 25, 64, "player", TCODColor.white);
            player.destruct = new PlayerDestructible(30, 2, "your corpse", this);
            player.ai = new PlayerAI();
            player.attacker = new Attacker(5);
            player.contain = new Container(20);

            if (fromload)
            {
                player.destruct.hp = gameState.curhp;
                loadInv();
            }

            actors.Add(player);
            fovRadius = 10;

            map = new Map(Globals.WIDTH, Globals.HEIGHT-Globals.PANEL, this);
            this.gui = new GUI(this);
        }
Exemple #2
0
 public Portal(Map map, bool forward, bool last)
 {
     this.map = map;
     this.forward = forward;
     this.last = last;
 }