Exemple #1
0
 public Hex GetHexByPoint(Point hexCenterPoint)
 {
     var x = Convert.ToInt32(hexCenterPoint.X / (X_CENTRE_DISTANCE_FACTOR * a));
     var y = Convert.ToInt32(hexCenterPoint.Y / r);
     var inx = new Index2D(x, y);
     if (hexMap.ContainsKey(inx))
         return hexMap[inx];
     else
         return new Hex(inx);
 }
Exemple #2
0
        public Hex(Index2D inx, Point center,  HexType type, int height)
        {
            r = GlobalConst.DEFAULT_r;
            a = 2d / Math.Sqrt(3) * r;
            index = inx;
            this.type = type;
            this.height = height;

            if (type != HexType.Empty)
                render = new HexRender(DisplayType.GAME_SimpleGround, height, center);
        }
Exemple #3
0
 public Hex(Index2D inx)
     : this(inx, new Point(), HexType.Empty, DEFAULT_HEIGHT)
 {
 }
Exemple #4
0
 public Point GetCoordinateByIndex(Index2D inx)
 {
     return new Point((X_CENTRE_DISTANCE_FACTOR * a) * inx.X, r * inx.Y);
 }