예제 #1
0
        static public Hex RoffsetToCube(int offset, OffsetCoord h)
        {
            int q = h.col - (int)((h.row + offset * (h.row & 1)) / 2);
            int r = h.row;
            int s = -q - r;

            if (offset != OffsetCoord.EVEN && offset != OffsetCoord.ODD)
            {
                throw new ArgumentException("offset must be EVEN (+1) or ODD (-1)");
            }
            return(new Hex(q, r, s));
        }
예제 #2
0
 public OffsetCoord ToOffsetCoord()
 {
     return(OffsetCoord.QoffsetFromCube(OffsetCoord.ODD, this));
 }