public void PlacePlayer(Player player) { Random random = new Random(); int _placed = 0; do { int _randX = random.Next(0, MapSizeX); int _randY = random.Next(0, MapSizeY); Tile CurrentTile = (Tile)GameMap[_randX, _randY]; bool _iswalkable = CurrentTile.IsWalkable; bool _ishallway = CurrentTile.IsHallway; if (_iswalkable && _placed == 0 && !_ishallway) { CurrentTile.Icon = PlayerIcon; CurrentTile.IsWalkable = false; player.X = _randX; player.Y = _randY; _placed = 1; } } while (_placed == 0); StatBar.Display(player); }
public void NextTileIsWalkable(Tile CurrentTile, Tile NextTile, Player player, string _direction) { CurrentTile.Icon = FloorIcon; CurrentTile.IsWalkable = true; NextTile.Icon = PlayerIcon; NextTile.IsWalkable = false; player.X = NextTile.X; player.Y = NextTile.Y; StatBar.Display(player); ActivityLog.AddToLog("You move " + _direction + "."); }
public void CurrentTileIsItem(Tile CurrentTile, Tile NextTile, List <Item> activeItems, Player player, string _direction) { for (int i = 0; i < activeItems.Count; i++) { if (activeItems[i].X == CurrentTile.X && activeItems[i].Y == CurrentTile.Y) { CurrentTile.Icon = activeItems[i].Icon; CurrentTile.IsWalkable = true; NextTile.Icon = PlayerIcon; NextTile.IsWalkable = false; player.X = NextTile.X; player.Y = NextTile.Y; StatBar.Display(player); ActivityLog.AddToLog("You move " + _direction + "."); } } }