本文整理汇总了C#中Map.IsPointOnMap方法的典型用法代码示例。如果您正苦于以下问题:C# Map.IsPointOnMap方法的具体用法?C# Map.IsPointOnMap怎么用?C# Map.IsPointOnMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map.IsPointOnMap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsPositionClear
private bool IsPositionClear(Map map, Point upperLeftCorner)
{
if (!map.IsPointOnMap(upperLeftCorner))
return false;
if (!map.IsPointOnMap(upperLeftCorner + new Point(Width, Height)))
return false;
for (int i = 0; i < Width; ++i)
{
for (int j = 0; j < Height; ++j)
{
Point mapPosition = upperLeftCorner + new Point(i, j);
if (map.GetTerrainAt(mapPosition) == TerrainType.Floor)
return false;
}
}
return true;
}
示例2: CountNumberOfSurroundingWallTilesTwoStepAway
protected static int CountNumberOfSurroundingWallTilesTwoStepAway(Map map, int x, int y)
{
int numberOfFloorTileSurrounding = 0;
for (int i = -2; i <= 2; ++i)
{
for (int j = -2; j <= 2; ++j)
{
if ((i == 2 || i == -2) && (j == 2 || j == -2))
continue;
if (map.IsPointOnMap(x + i, y + j))
{
if (map.GetTerrainAt(x + i, y + j) == TerrainType.Wall)
numberOfFloorTileSurrounding++;
}
}
}
return numberOfFloorTileSurrounding;
}
示例3: FloodFill
protected void FloodFill(Map map, int x, int y, byte scratchValue)
{
if (!map.IsPointOnMap(x, y))
return;
if (map.GetTerrainAt(x, y) == TerrainType.Floor && map.GetScratchAt(x, y) == 0)
{
map.SetScratchAt(x, y, scratchValue);
FloodFill(map, x + 1, y, scratchValue);
FloodFill(map, x - 1, y, scratchValue);
FloodFill(map, x, y + 1, scratchValue);
FloodFill(map, x, y - 1, scratchValue);
}
}
示例4: CountNumberOfSurroundingWallTilesOneStepAway
protected static int CountNumberOfSurroundingWallTilesOneStepAway(Map map, int x, int y)
{
int numberOfFloorTileSurrounding = 0;
for (int i = -1; i <= 1; ++i)
{
for (int j = -1; j <= 1; ++j)
{
if (map.IsPointOnMap(x + i, y + j))
{
if (map.GetTerrainAt(x + i, y + j) == TerrainType.Wall)
numberOfFloorTileSurrounding++;
}
}
}
return numberOfFloorTileSurrounding;
}
示例5: StripImpossibleDoors
private void StripImpossibleDoors(Map map)
{
foreach (MapDoor door in map.MapObjects.OfType<MapDoor>().ToList())
{
if (!map.IsPointOnMap(door.Position) || map.GetTerrainAt(door.Position) == TerrainType.Wall ||
!WallsOnOneSetOfSides(map, door))
{
map.RemoveMapItem(door);
}
}
List<Point> doorPositions = map.MapObjects.OfType<MapDoor>().Select(x => x.Position).ToList();
foreach (MapDoor door in map.MapObjects.OfType<MapDoor>().ToList())
{
if (doorPositions.Exists(x => x != door.Position && PointDirectionUtils.NormalDistance(x, door.Position) < 2))
{
map.RemoveMapItem(door);
doorPositions.Remove(door.Position);
}
}
}