public static void Main(string[] args) { Hero hero = new Hero("Bron", "Dragonslayer", 100, 100, 2); Spell spell = new Spell("Fireball", 20, 60, 2); Weapon wep = new Weapon("Stinger", 5); hero.Equip(wep); hero.Learn(spell); Dungeon dung = new Dungeon(); string map = @"C:\Users\Budinov\Documents\Visual Studio 2015\Projects\Week05Day03\ConsoleApplication2\level1.txt"; dung.GenerateMap(map); dung.Spawn(hero); dung.PrintMap(); dung.MoveHero(Dungeon.Direction.Left); dung.PrintMap(); dung.MoveHero(Dungeon.Direction.Left); dung.PrintMap(); }
public bool Spawn(Hero hero) { for (int i = 0; i < map.Count; i++) { for (int j = 0; j < map[i].Length; j++) { if (map[i][j].Equals('S')) { map[i][j] = 'H'; heroListPosition = i; heroArrPosition = j; this.hero = hero; return true; } } } return false; }