public MovementTurnStepAction(Avatar actor, PointList stepsToLocation, MapTile interestingLocation=null) : base(false) { _avatar = actor; _stepsToLocation = stepsToLocation; RequiresMovement = true; HasMoreTurns = (_stepsToLocation.Count > 1) ? true : false; // If there are more steps, then we can be used in subsequent turns! AcceptsAvatarFocus = HasMoreTurns; }
public AbstractQuest(Point mapStaircaseOrigin, List<Hero> heroes) : base() { _avatarMapTiles = new Dictionary<Avatar, MapTile>(); Map = new QuestMap(mapStaircaseOrigin); Heroes = heroes; // Add the Hero map tiles to the quest board List<Point> staircaseLocations = Map.HeroStartingLocations; int counter = 0; foreach(Hero hero in Heroes) { int index = counter % staircaseLocations.Count; Point location = staircaseLocations[index]; MapTile heroTile = new MapTile(hero.ImagePath, false, false, false, false, false); _avatarMapTiles[hero] = heroTile; Map.AddTile(location, heroTile); counter++; } Monsters = new List<Monster>(); }
public void AddMonster(Monster monster, Point toLocation) { Monsters.Add(monster); MapTile monsterTile = new MapTile(monster.ImagePath, false, false, false, false, false); _avatarMapTiles[monster] = monsterTile; Map.AddTile(toLocation, monsterTile); }
public OpenDoorAction(MapTile doorTileA, MapTile doorTileB) : base(false) { _doorTileA = doorTileA; _doorTileB = doorTileB; }
public Point GetRelativeLocationFor(MapTile tile) { return _mapTileRelativeLocations[tile]; }
public void AddTile(MapTile mapTile, Point toRelativePoint) { _mapTiles.Add(mapTile); _mapTileRelativeLocations[mapTile] = toRelativePoint; }
public void RemoveMapTile(MapTile removeTile) { // Look through all the tiles for the specific map tile instance for (int y = 0; y < MAP_HEIGHT_IN_TILES; y++) { for (int x = 0; x < MAP_WIDTH_IN_TILES; x++) { MapTileList tiles = GetMapTilesForLocation(x, y); for(int i=tiles.Count-1; i >= 0; i--) { MapTile tile = tiles[i]; if (tile == removeTile) { tiles.RemoveAt(i); _mapTileLocations.Remove(tile); } } } } }
public Point GetMapTileLocation(MapTile mapTile) { for (int y = 0; y < MAP_HEIGHT_IN_TILES; y++) { for (int x = 0; x < MAP_WIDTH_IN_TILES; x++) { MapTileList tiles = GetMapTilesForLocation(x, y); if (tiles.Contains(mapTile)) { return new Point(x, y); } } } return null; }
public void AddTileIfMatchNotAlreadyThere(int x, int y, MapTile tileTemplate) { List<MapTile> mapTiles = GetMapTilesForLocation(x, y); // Check to see if the map tile already includes a left wall Boolean foundMatch = false; foreach (MapTile tile in mapTiles) { if (tile.Equals(tileTemplate)) { foundMatch = true; break; } } if (!foundMatch) { mapTiles.Add(tileTemplate); _mapTileLocations[tileTemplate] = new Point(x, y); } }
public void FillAreaWithTile(Point origin, int tilesWide, int tilesTall, MapTile tileTemplate) { Rectangle area = new Rectangle(origin.X, origin.Y, origin.X + tilesWide, origin.Y + tilesTall); for (int y = area.Y; y < area.Height; y++) { for (int x = area.X; x < area.Width; x++) { MapTileList mapTiles = GetMapTilesForLocation(x, y); MapTile tileToAdd = (MapTile)tileTemplate.Clone(); mapTiles.Add(tileToAdd); _mapTileLocations[tileToAdd] = new Point(x, y); } } }
public void SetBaseAreaWithTile(Point origin, int tilesWide, int tilesTall, MapTile tileTemplate) { Rectangle area = new Rectangle(origin.X, origin.Y, origin.X + tilesWide, origin.Y + tilesTall); for (int y = area.Y; y < area.Height; y++) { for (int x = area.X; x < area.Width; x++) { MapTileList mapTiles = GetMapTilesForLocation(x, y); MapTile tileToAdd = (MapTile)tileTemplate.Clone(); if (mapTiles.Count > 0) { _mapTileLocations.Remove(mapTiles[0]); mapTiles[0] = tileToAdd; } else { mapTiles.Add(tileToAdd); } _mapTileLocations[tileToAdd] = new Point(x, y); } } }
public void SetBaseTile(int originX, int originY, MapTile tile) { List<MapTile> tiles = GetMapTilesForLocation(originX, originY); if (tiles.Count > 0) { _mapTileLocations.Remove(tiles[0]); tiles[0] = tile; } else { tiles.Add(tile); } _mapTileLocations[tile] = new Point(originX, originY); }
public void SetBaseTile(Point origin, MapTile tile) { SetBaseTile(origin.X, origin.Y, tile); }
public void AddTile(int originX, int originY, MapTile tile) { List<MapTile> tiles = GetMapTilesForLocation(originX, originY); tiles.Add(tile); _mapTileLocations[tile] = new Point(originX, originY); }
public void AddTile(Point origin, MapTile tile) { AddTile(origin.X, origin.Y, tile); }
virtual public Boolean Equals(MapTile otherTile) { // We probably only need to check the image path, since we are not re-using images across multiple tiles, but added the other checks for safety return (ImagePath.Equals(otherTile.ImagePath) /*&& BlocksMovement == otherTile.BlocksMovement*/ && BlocksWest == otherTile.BlocksWest && BlocksNorth == otherTile.BlocksNorth && BlocksEast == otherTile.BlocksEast && BlocksSouth == otherTile.BlocksSouth); }
public PathfindingNode GetPathfindingNodeForTile(MapTile tile) { // Look up the location of the tile Point location = _mapTileLocations[tile]; return GetPathfindingNodeForLocation(location.X, location.Y); }
/// <summary> /// Moves the map tile from one location to another. Primarily used to move the Hero & monster tiles around the board. /// </summary> /// <param name="tile"></param> /// <param name="toPoint"></param> public void MoveMapTile(MapTile tile, Point toPoint) { Point tileLocation = _mapTileLocations[tile]; MapTileList locationTiles = GetMapTilesForPoint(tileLocation); if (!locationTiles.Contains(tile)) { throw new Exception("QuestMap MoveMapTile(tile, toPoint) called, but no tile was found!"); } else { // Remove it from its' old location locationTiles.Remove(tile); // And add it to the new location MapTileList newLocationTiles = GetMapTilesForPoint(toPoint); newLocationTiles.Add(tile); _mapTileLocations[tile] = toPoint; } }