当前位置: 首页>>代码示例>>C#>>正文


C# Tile.IsOccupied方法代码示例

本文整理汇总了C#中Tile.IsOccupied方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.IsOccupied方法的具体用法?C# Tile.IsOccupied怎么用?C# Tile.IsOccupied使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tile的用法示例。


在下文中一共展示了Tile.IsOccupied方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalculateDistanceAndUpdatePath

    public static void CalculateDistanceAndUpdatePath(Tile currentTile, Tile neighbor, 
	                                                  Dictionary<Tile, int> tileToDistance, Dictionary<Tile, Tile> tileToOptimalPrevious, 
	                                                  bool moveThroughOccupied)
    {
        if (neighbor == null || (neighbor.IsOccupied() && !moveThroughOccupied)) {
            return;
        }
        int totalDistance = tileToDistance[currentTile] + 1;
        if (!tileToDistance.ContainsKey(neighbor)) {
            tileToDistance.Add(neighbor, totalDistance);
            tileToOptimalPrevious[neighbor] = currentTile;
        } else if (totalDistance < tileToDistance[neighbor]) {
            tileToDistance[neighbor] = totalDistance;
            tileToOptimalPrevious[neighbor] = currentTile;
        }
    }
开发者ID:Shnagenburg,项目名称:TacticsGame,代码行数:16,代码来源:FindShortestPath.cs

示例2: IsTraversable

 public static bool IsTraversable(Tile tile, bool moveThroughOccupiedTiles)
 {
     return (tile != null && ( !tile.IsOccupied() || moveThroughOccupiedTiles));
 }
开发者ID:Shnagenburg,项目名称:TacticsGame,代码行数:4,代码来源:FindTilesWithinRange.cs

示例3: TileIsFree

    protected bool TileIsFree(Tile tile, int radius)
    {
        // make sure that given tile, and all tiles around in given radius are not occupied

        // if there is not tile, tile is not free
        if (tile == null) { return false; }

        // if tile is occupied, tile is not free
        if (tile.IsOccupied()) { return false; }

        // if any tile inside given radius is occupied, tile is not free
        List<Tile> tiles = grid.GetNeighboursInsideRadius(tile.x, tile.y, radius);
        foreach (Tile neighbour in tiles) {
            if (neighbour.IsOccupied()) { return false; }
        }

        // there is a door adjacent to the tile in 4 directions, tile is not free
        if (IsAdjacentToDoor(tile.x, tile.y)) { return false; }

        // otherwise, tile is free
        return true;
    }
开发者ID:snaptothegrid,项目名称:Tiler,代码行数:22,代码来源:DungeonFeatureGenerator.cs


注:本文中的Tile.IsOccupied方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。