Пример #1
0
		public static int Distance(Cube a, Cube b)
		{
			return Length(Subtract(a, b));
		}
Пример #2
0
		public static int Length(Cube hex)
		{
			return (Math.Abs(hex.X) + Math.Abs(hex.Y) + Math.Abs(hex.Z)) / 2;
		}
Пример #3
0
		public static Cube Add(Cube a, Cube b)
		{
			return new Cube(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
		}
Пример #4
0
		public static Cube Subtract(Cube a, Cube b)
		{
			return new Cube(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
		}
Пример #5
0
		public static Cube Neighbor(Cube hex, int direction)
		{
			return Add(hex, Direction(direction));
		}