catan.Tile.hasNeighbor C# (CSharp) Method

hasNeighbor() public method

public hasNeighbor ( NeighborLocation loc ) : System.Boolean
loc NeighborLocation
return System.Boolean
        public Boolean hasNeighbor(NeighborLocation loc)
        {
            return Neighbors.ContainsKey(loc);
        }

Usage Example

Exemplo n.º 1
0
Arquivo: Game.cs Projeto: arun21/Catan
        private void checkNeighbors(Tile currentTile, int widthCounter)
        {
            widthCounter++;
            for (int i = 0; i < 6; ++i)
            {
                int a = 0;
                a++;
                Debug.Assert(LandTileHeap.Count != 0);

                if (!currentTile.hasNeighbor((NeighborLocation)i))
                {
                    currentTile.addNeighbor(LandTileHeap.TakeAway(rand.Next() % LandTileHeap.Count), (NeighborLocation)i);
                    currentTile.Neighbors.Single(n => n.Key == (NeighborLocation)i).Value.addNeighbor(currentTile, (NeighborLocation)((i + 3) % 6));
                    Tile tempTile = currentTile.Neighbors.Single(n => n.Key == (NeighborLocation)i).Value;

                    for (int j = 0; j < i; ++j)
                    {
                        tempTile.addNeighbor(currentTile.Neighbors.Single(n => n.Key == (NeighborLocation)j).Value, (NeighborLocation)(((j + 3) % 6) - 1));
                    }


                    if (widthCounter < 3)
                    {
                        checkNeighbors(tempTile, widthCounter);
                    }
                }
            }
        }
All Usage Examples Of catan.Tile::hasNeighbor