Ejemplo n.º 1
0
    public TileConnector GetOppositeConnector(TileConnector.DIRECTION dirn)
    {
        for (int i = 0; i < connections.Length; ++i)
        {
            if (connections[i].direction == TileConnector.GetOppositeDirection(dirn))
            {
                return(connections[i]);
            }
        }

        return(null);
    }
    Tile FindEndTile(TileConnector parentConnector)
    {
        for (int i = 0; i < _totalTilesInBaseTileSet; ++i)
        {
            Tile baseTile       = _baseTileSet[i];
            int  numConnections = baseTile.connections.Length;

            if (numConnections > 1)
            {
                continue;
            }

            for (int j = 0; j < numConnections; ++j)
            {
                if (baseTile.connections[j].direction == TileConnector.GetOppositeDirection(parentConnector.direction))
                {
                    return(baseTile);
                }
            }
        }

        Debug.Log("Error: Unable to find a end tile to fill");
        return(null);
    }