Beispiel #1
0
 int ManhattanDist(int a, int b)
 {
     //		int x_diff = Mathf.Abs(HexGrid.instance.all_cells[a].x - HexGrid.instance.all_cells[b].x);
     //		int y_diff = Mathf.Abs(HexGrid.instance.all_cells[a].y - HexGrid.instance.all_cells[b].y);
     //		return x_diff+y_diff;
     return(HexCell.Distance(HexGrid.instance.all_cells[a], HexGrid.instance.all_cells[b]));
 }
Beispiel #2
0
        static public List <HexCell> HexLinedraw(HexCell a, HexCell b)
        {
            int            N       = HexCell.Distance(a, b);
            FractionalHex  a_nudge = new FractionalHex(a.q + 0.000001, a.r + 0.000001, a.s - 0.000002);
            FractionalHex  b_nudge = new FractionalHex(b.q + 0.000001, b.r + 0.000001, b.s - 0.000002);
            List <HexCell> results = new List <HexCell> {
            };
            double step            = 1.0 / Math.Max(N, 1);

            for (int i = 0; i <= N; i++)
            {
                results.Add(FractionalHex.HexRound(FractionalHex.HexLerp(a_nudge, b_nudge, step * i)));
            }
            return(results);
        }