Ejemplo n.º 1
0
		public PointList GetAdjacentUnwalkedTiles(Point origin, Faction faction)
		{
			PointList list = GetVisibleAdjacentPoints(origin, new PointList());

			PointList factionWalkedOnList = new PointList();
			if (_tilesWalkedOn.ContainsKey(faction))
			{ factionWalkedOnList = _tilesWalkedOn[faction]; }
			
			for(int i=list.Count-1; i >= 0; i--)
			{
				Point point = list[i];
				if (factionWalkedOnList.ContainsLocation(point.X, point.Y))
				{ list.RemoveAt(i); }
			}

			return list;
		}
Ejemplo n.º 2
0
		public PointList GetVisibleAdjacentPoints(Point origin, PointList skipPoints)
		{
			PointList adjacentPoints = new PointList();

			MapTileList originTiles = GetMapTilesForPoint(origin);
			Boolean originBlocksLineOfSightNorth = false;
			Boolean originBlocksLineOfSightEast = false;
			Boolean originBlocksLineOfSightSouth = false;
			Boolean originBlocksLineOfSightWest = false;
			if (originTiles.BlocksLineOfSight)
			{ return adjacentPoints; } // If the tile itself blocks all line of sight, then nothing is visible
			if (originTiles.BlocksLineOfSightNorth)
			{ originBlocksLineOfSightNorth = true; }
			if (originTiles.BlocksLineOfSightEast)
			{ originBlocksLineOfSightEast = true; }
			if (originTiles.BlocksLineOfSightSouth)
			{ originBlocksLineOfSightSouth = true; }
			if (originTiles.BlocksLineOfSightWest)
			{ originBlocksLineOfSightWest = true; }

			if (origin.X > 0 &&  !originBlocksLineOfSightWest && !skipPoints.ContainsLocation(origin.X - 1, origin.Y))
			{ adjacentPoints.Add(new Point(origin.X - 1, origin.Y)); }
			if (origin.X < MAP_WIDTH_IN_TILES - 1 && !originBlocksLineOfSightEast && !skipPoints.ContainsLocation(origin.X + 1, origin.Y))
			{ adjacentPoints.Add(new Point(origin.X + 1, origin.Y)); }
			if (origin.Y > 0 && !originBlocksLineOfSightNorth && !skipPoints.ContainsLocation(origin.X, origin.Y - 1))
			{ adjacentPoints.Add(new Point(origin.X, origin.Y - 1)); }
			if (origin.Y < MAP_HEIGHT_IN_TILES - 1 && !originBlocksLineOfSightSouth && !skipPoints.ContainsLocation(origin.X, origin.Y+1))
			{ adjacentPoints.Add(new Point(origin.X, origin.Y + 1)); }

			return adjacentPoints;
		}