public Map GenerateRandom(int floorNumber) { Map currentMap = new Map(); enemiesOnMap = new List <Enemy>(); System.Random rnd = new System.Random(); if (floorNumber == 5) { Map newMap1 = LoadMap("2.txt"); return(newMap1); } DungeonGenerator mapGenerator = new DungeonGenerator(100, 50); int[][] dungeon = new int[100][]; int rowAmmount = 0; int columnAmmount = 0; switch (floorNumber) { case 1: rowAmmount = 25; columnAmmount = 50; dungeon = mapGenerator.CreateDungeon(columnAmmount, rowAmmount, 8); break; case 2: rowAmmount = 35; columnAmmount = 70; dungeon = mapGenerator.CreateDungeon(columnAmmount, rowAmmount, 13); break; case 3: rowAmmount = 45; columnAmmount = 85; dungeon = mapGenerator.CreateDungeon(columnAmmount, rowAmmount, 16); break; case 4: rowAmmount = 50; columnAmmount = 100; dungeon = mapGenerator.CreateDungeon(columnAmmount, rowAmmount, 20); break; } Map newMap = new Map(dungeon, display, this, rowAmmount, columnAmmount); display.DrawFrame(); currentMap = newMap; hero.SetCurrentMap(currentMap); ChangeFloorNumber(floorNumber); display.SetStatUI(1, hero.name); float sliderHp = (float)hero.hp / (float)hero.maxHp; display.SetStatUI(2, sliderHp.ToString()); display.SetStatUI(6, gold.ToString()); display.SetStatUI(7, enemiesKilled.ToString()); bool displayed = false; for (int i = 0; i < 6; i++) { if (hero.equipment[i] != null) { display.RefreshItem(i, hero.equipment[i].name); displayed = true; break; } } if (!displayed) { display.RefreshItem(-1, "Whatever"); } whatInControl = 0; currentMap.SetFocus(); display.RefreshVisibility(hero.positionX, hero.positionY, currentMap.tileMap); return(newMap); }
public void RefreshVision(int posX, int posY) { display.RefreshVisibility(posX, posY, tileMap); }