Ejemplo n.º 1
0
        internal bool CheckForPath(int x, int y, InputHandler mouse, CheckForPathType type)
        {
            Node portaledTo = nodes[x, y].portalsTo;

            switch (type)
            {
            case CheckForPathType.AddingPortal:
                nodes[x, y].portal             = true;
                nodes[x, y].portalsTo          = mouse.PortalEntrance;
                mouse.PortalEntrance.portalsTo = nodes[x, y];
                break;

            case CheckForPathType.RemovingPortal:
                nodes[x, y].portal    = false;
                nodes[x, y].portalsTo = null;
                portaledTo.portalsTo  = null;
                portaledTo.portal     = false;
                break;

            case CheckForPathType.TogglingCheese:
                nodes[x, y].cheese = !nodes[x, y].cheese;
                break;

            default:
                nodes[x, y].wall = !nodes[x, y].wall;
                break;
            }

            List <Node> bestPath = PathFinding.findBestPath(nodes);

            switch (type)
            {
            case CheckForPathType.AddingPortal:
                nodes[x, y].portal             = false;
                nodes[x, y].portalsTo          = null;
                mouse.PortalEntrance.portalsTo = null;
                break;

            case CheckForPathType.RemovingPortal:
                nodes[x, y].portal    = true;
                nodes[x, y].portalsTo = portaledTo;
                portaledTo.portalsTo  = nodes[x, y];
                portaledTo.portal     = true;
                break;

            case CheckForPathType.TogglingCheese:
                nodes[x, y].cheese = !nodes[x, y].cheese;
                break;

            default:
                nodes[x, y].wall = !nodes[x, y].wall;
                break;
            }

            return(bestPath != null);
        }
Ejemplo n.º 2
0
 internal List <Node> GetBestPath()
 {
     return(PathFinding.findBestPath(nodes));
 }