Esempio n. 1
0
 public static int NumberOfNeighborsTo(this IEnumerable<Tile> tiles, Tile other)
 {
     return tiles.Count(tile => tile | other);
 }
Esempio n. 2
0
 public void SetTile(Tile tile)
 {
     throw new NotImplementedException();
 }
Esempio n. 3
0
 /// <summary>
 /// Visszaad egy felsorolást azokból a "tiles"-ban szereplő mezőkből, melyek szomszédosak az "other" mezővel.
 /// </summary>
 /// <param name="tiles">Mezők kollekciója.</param>
 /// <param name="other">A vizsgált mező.</param>
 /// <returns></returns>
 public static IEnumerable<Tile> GetNeighboringTiles(this ICollection<Tile> tiles, Tile other)
 {
     return from Tile tile in tiles
            where tile | other
            select tile;
 }
Esempio n. 4
0
 /// <summary>
 /// Kiértékeli, hogy a kapott mező emellé rakható-e.
 /// </summary>
 /// <param name="other">A másik játékmező.</param>
 /// <returns>A másik játékmező lerkaható-e emellé.</returns>
 public bool IsValidAdjacent(Tile other)
 {
     return this | other && IsSideTypeCompatible(other);
 }
Esempio n. 5
0
        /// <summary>
        /// Kiértékeli, hogy a másik mező ezzel szemben lévő oldalán a terület típusok egyeznek.
        /// </summary>
        /// <param name="other">A másik játékmező.</param>
        /// <returns>Terület típusok szerint lerakható-e a mező emellé.</returns>
        private bool IsSideTypeCompatible(Tile other)
        {
            foreach (Direction facingMinorDirection in DirectionTo(other).MinorDirections())
                if (this[facingMinorDirection].AreaType != other[facingMinorDirection.Opposite()].AreaType)
                    return false;

            return true;
        }
Esempio n. 6
0
 private Tile ReadTestIndexerData(DataRow row)
 {
     var subAreas = ReadSubAreas(row[string.Format(areaDescriptionKeyTemplate, "")].ToString().Split(';'));
     Tile t = new Tile(subAreas, new Position(0, 0));
     t.Rotation = ReadEnum<TileRotation>(row, "Rotation");
     return t;
 }
Esempio n. 7
0
 private Tile ReadTestRotateData(DataRow row)
 {
     TileRotation rotation = ReadEnum<TileRotation>(row, "Rotation");
     Tile t = new Tile();
     t.Rotation = rotation;
     return t;
 }