示例#1
0
 static public bool Equals(Hex a, Hex b)
 {
     return((a.q == b.q) && (a.r == b.r) && (a.s == b.s));
 }
示例#2
0
 static public int Length(Hex hex)
 {
     return((int)((Math.Abs(hex.q) + Math.Abs(hex.r) + Math.Abs(hex.s)) / 2));
 }
示例#3
0
 static public int Distance(Hex a, Hex b)
 {
     return(Hex.Length(Hex.Subtract(a, b)));
 }
示例#4
0
 static public Hex DiagonalNeighbor(Hex hex, int direction)
 {
     return(Hex.Add(hex, Hex.diagonals[direction]));
 }
示例#5
0
 static public Hex Neighbor(Hex hex, int direction)
 {
     return(Hex.Add(hex, Hex.Direction(direction)));
 }
示例#6
0
 static public Hex Scale(Hex a, int k)
 {
     return(new Hex(a.q * k, a.r * k, a.s * k));
 }
示例#7
0
 static public Hex Subtract(Hex a, Hex b)
 {
     return(new Hex(a.q - b.q, a.r - b.r, a.s - b.s));
 }
示例#8
0
 static public Hex Add(Hex a, Hex b)
 {
     return(new Hex(a.q + b.q, a.r + b.r, a.s + b.s));
 }