Пример #1
0
        /// <summary>
        /// Returns an objectmodel collection of the type mapNode, which contains all the successor nodes to this node.
        /// </summary>
        internal Collection <mapNode> Successors(DenDribbelaerPathfinder Pathfinder)
        {
            Collection <mapNode> tmp = new Collection <mapNode>();

            if (Pathfinder.Passable(X, Y, X - 1, Y))
            {
                tmp.Add(createNode(X - 1, Y)); // Left
            }
            if (Pathfinder.Passable(X, Y, X + 1, Y))
            {
                tmp.Add(createNode(X + 1, Y)); // Right
            }
            if (Pathfinder.Passable(X, Y, X, Y + 1))
            {
                tmp.Add(createNode(X, Y + 1)); // Up
            }
            if (Pathfinder.Passable(X, Y, X, Y - 1))
            {
                tmp.Add(createNode(X, Y - 1)); // Down
            }
            if (Pathfinder.Passable(X, Y, X - 1, Y + 1))
            {
                tmp.Add(createNode(X - 1, Y + 1)); // Left up
            }
            if (Pathfinder.Passable(X, Y, X - 1, Y - 1))
            {
                tmp.Add(createNode(X - 1, Y - 1)); // Left down
            }
            if (Pathfinder.Passable(X, Y, X, Y + 1))
            {
                tmp.Add(createNode(X, Y + 1)); // Mid up
            }
            if (Pathfinder.Passable(X, Y, X, Y - 1))
            {
                tmp.Add(createNode(X, Y - 1)); // Mid down
            }
            if (Pathfinder.Passable(X, Y, X + 1, Y + 1))
            {
                tmp.Add(createNode(X + 1, Y + 1)); // Right up
            }
            if (Pathfinder.Passable(X, Y, X + 1, Y - 1))
            {
                tmp.Add(createNode(X + 1, Y - 1)); // Right down
            }
            return(tmp);
        }
Пример #2
0
        /// <summary>
        /// Returns an objectmodel collection of the type mapNode, which contains all the successor nodes to this node.
        /// </summary>
        internal Collection<mapNode> Successors(DenDribbelaerPathfinder Pathfinder)
        {
            Collection<mapNode> tmp = new Collection<mapNode>();
            if (Pathfinder.Passable(X, Y, X - 1, Y))
                tmp.Add(createNode(X - 1, Y)); // Left
            if (Pathfinder.Passable(X, Y, X + 1, Y))
                tmp.Add(createNode(X + 1, Y)); // Right
            if (Pathfinder.Passable(X, Y, X, Y + 1))
                tmp.Add(createNode(X, Y + 1)); // Up
            if (Pathfinder.Passable(X, Y, X, Y - 1))
                tmp.Add(createNode(X, Y - 1)); // Down
            if (Pathfinder.Passable(X, Y, X - 1, Y + 1))
                tmp.Add(createNode(X - 1, Y + 1)); // Left up
            if (Pathfinder.Passable(X, Y, X - 1, Y - 1))
                tmp.Add(createNode(X - 1, Y - 1)); // Left down
            if (Pathfinder.Passable(X, Y, X, Y + 1))
                tmp.Add(createNode(X, Y + 1)); // Mid up
            if (Pathfinder.Passable(X, Y, X, Y - 1))
                tmp.Add(createNode(X, Y - 1)); // Mid down
            if (Pathfinder.Passable(X, Y, X + 1, Y + 1))
                tmp.Add(createNode(X + 1, Y + 1)); // Right up
            if (Pathfinder.Passable(X, Y, X + 1, Y - 1))
                tmp.Add(createNode(X + 1, Y - 1)); // Right down

            return tmp;
        }