getNeighbors() public method

public getNeighbors ( ) : List
return List
Ejemplo n.º 1
0
        public Sun(Hex3D h)
        {
            color = defaultcolor;
            SetHex(h);
            h.passable = false;
            h.defaultcolor = Color.Black;

            foreach (Hex3D n in h.getNeighbors())
            {
                n.passable = false;
                n.defaultcolor = Color.Black;

            }
        }
Ejemplo n.º 2
0
 private void Shootable(HashSet<Hex3D> hexes, Hex3D h, int r)
 {
     if (r <= 0) return;
     foreach (Hex3D n in h.getNeighbors())
     {
         hexes.Add(n);
         Shootable(hexes, n, r - 1);
     }
 }
Ejemplo n.º 3
0
        List<Hex3D> reachable(Hex3D startHex, int r)
        {
            startHex.distance = r;
            List<Hex3D> hexes = new List<Hex3D>();
            if (r <= 0)
            {
                return hexes;
            }
            foreach (Hex3D h in startHex.getNeighbors())
            {
                //if (!h.passable) continue;
                int dist = h.distance;
                if (dist == -1 || dist < r - 1)
                {
                    hexes.Add(h);
                    hexes.AddRange(reachable(h, r - 1));
                }
            }

            return hexes;
        }