Inheritance: IntTuple
Esempio n. 1
0
        private readonly Vertex[] _vertices = new Vertex[6]; // 6 vertices

        #endregion Fields

        #region Constructors

        public Hexagon(int id, DegreeType degree, Position position)
        {
            ProductionNumber = id;
            Degree = degree;
            Position = position;
        }
Esempio n. 2
0
 private Position HexPosToConsolePos(Position hexPos)
 {
     int x = (hexPos.X - _board.MinX)*4 + 3;
     int y = (_board.MaxY - hexPos.Y)*4 + 3 - hexPos.X*2;
     return new Position(x, y);
 }
Esempio n. 3
0
 public Hexagon this[Position pos]
 {
     get { return GetHexagonOrNull(pos); }
 }
Esempio n. 4
0
 IHexagon IBoard.this[Position pos]
 {
     get { return GetHexagonOrNull(pos); }
 }
Esempio n. 5
0
 private Hexagon GetHexagonOrNull(Position position)
 {
     Hexagon hex;
     _hexgonPositions.TryGetValue(position, out hex);
     return hex;
 }
Esempio n. 6
0
 internal void GetLimits(Position pos)
 {
     MinX = Math.Min(pos.X, MinX);
     MaxX = Math.Max(pos.X, MaxX);
     MinY = Math.Min(pos.Y, MinY);
     MaxY = Math.Max(pos.Y, MaxY);
 }
Esempio n. 7
0
 internal Hexagon CreateHexagon(int id, DegreeType degree, Position position)
 {
     var hex = new Hexagon(id, degree, position);
     _hexagons.Add(hex);
     _hexgonPositions[position] = hex;
     if (!_id2HexgonMap.ContainsKey(id))
     {
         _id2HexgonMap[id] = new List<Hexagon>();
     }
     _id2HexgonMap[id].Add(hex);
     return hex;
 }