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