示例#1
0
 private ReadOnlyCollection <NeighborIndices> LoadNeighborsData(IEnumerable <Tile> tiles)
 {
     NeighborIndices[] ret = new NeighborIndices[tiles.Max(item => item.BufferIndex) + 1];
     foreach (Tile tile in tiles)
     {
         ret[tile.BufferIndex] = LoadNeighborIndicie(tile);
     }
     return(ret.ToList().AsReadOnly());
 }
示例#2
0
    private NeighborIndices[] GetNeighborsData()
    {
        NeighborIndices[] ret = new NeighborIndices[MaxIndex];
        Dictionary <string, HexCenter> indexTable = BaseHexs.ToDictionary(GetKey, item => item);

        for (int i = 0; i < MaxIndex; i++)
        {
            HexCenter       hex       = BaseHexs[i];
            NeighborIndices neighbors = GetNeihborsFor(hex, indexTable);
            ret[hex.Index] = neighbors;
        }
        return(ret);
    }