Ejemplo n.º 1
0
    public void generate(RogueMapParameters mapParameters)
    {
        currentMapParameters = mapParameters;
        miniMap     = new int[mapParameters.size[0], mapParameters.size[1]];
        miniRoomMap = new int[mapParameters.size[0], mapParameters.size[1]];
        roomDoor    = new List <int[]>();
        world       = new RogueMap();
        world.map   = new int[mapParameters.size[0] * 5, mapParameters.size[1] * 5];

        clear();

        createRooms();
        connectRooms();

        translate();

        //generateChests();
    }
Ejemplo n.º 2
0
    //Public
    public APPRogue()
        :       base("roguelike-v23.0.0.23-by-onionmilk")
    {
        generator = new RogueGenerator();
        RogueMapParameters mapParameters = new RogueMapParameters();

        mapParameters.size = new int[2] {
            20, 20
        };
        mapParameters.roomFrequency  = 0.2f;
        mapParameters.roomMaxSize    = 3;
        mapParameters.chestMaxAmount = 5;
        generator.generate(mapParameters);
        world = generator.getMap();

        player          = new RoguePlayer(world.map);
        player.position = generator.getSpawn();

        monsters = new RogueMonsters(world.map, player);
    }
Ejemplo n.º 3
0
    public override void ReactToInputKeyboard(SHGUIinput key)
    {
        if (mapView)            //Tryb podglądu mapy
        {
            if (key == SHGUIinput.up)
            {
                displayOffset[1] -= 1;
            }
            if (key == SHGUIinput.down)
            {
                displayOffset[1] += 1;
            }
            if (key == SHGUIinput.left)
            {
                displayOffset[0] -= 1;
            }
            if (key == SHGUIinput.right)
            {
                displayOffset[0] += 1;
            }
            //--
        }
        else if (key == SHGUIinput.up ||
                 key == SHGUIinput.down ||
                 key == SHGUIinput.left ||
                 key == SHGUIinput.right
                 )      //Czy się próbowano ruszyć
        {
            bool moved = false;
            if (key == SHGUIinput.up)
            {
                moved = player.moveBy(0, -1);
            }
            if (key == SHGUIinput.down)
            {
                moved = player.moveBy(0, +1);
            }
            if (key == SHGUIinput.left)
            {
                moved = player.moveBy(-1, 0);
            }
            if (key == SHGUIinput.right)
            {
                moved = player.moveBy(+1, 0);
            }
            if (moved)
            {
                updateLogic = true;
            }
            else
            {
                status.setMessage("Cannot move there!");
            }
            for (int m = 0; m < monsters.monsterList.Count; ++m)            //ruch potworów
            {
                monsters.monsterList[m].Move();
            }
        }


        if (key == SHGUIinput.enter)
        {
            RogueMapParameters mapParameters = new RogueMapParameters();
            mapParameters.size = new int[2] {
                20, 20
            };
            mapParameters.roomFrequency  = 0.3f;
            mapParameters.roomMaxSize    = 5;
            mapParameters.chestMaxAmount = 5;
            generator.generate(mapParameters);
            world = generator.getMap();

            player          = new RoguePlayer(world.map);
            player.position = generator.getSpawn();

            monsters = new RogueMonsters(world.map, player);
        }


        if (key == SHGUIinput.esc)
        {
            SHGUI.current.PopView();
        }
        //--
    }