예제 #1
0
        // Methods
        public void Update()
        {
            for (int x = 0; x < visualizeGrid.Width; x++)
            {
                for (int y = 0; y < visualizeGrid.Height; y++)
                {
                    // Get the current node
                    IBaseNode current = visualizeGrid[x, y];

                    // Make sure the node is walkable
                    if (current.IsWalkable == false)
                    {
                        continue;
                    }

                    // Check for occupied
                    if (visualizeGrid.IsObstacle(new Index(x, y)) == true)
                    {
                        continue;
                    }

                    if (!current.IsShowInDebugView())
                    {
                        continue;
                    }

                    // Process surrounding tiles
                    IBaseNode[] nodes = getSurroundingNodes(x, y);

                    // Process all surrounding tiles
                    foreach (IBaseNode node in nodes)
                    {
                        // Check for null
                        if (node == null)
                        {
                            continue;
                        }

                        // Check for walkable
                        if (node.IsWalkable == false)
                        {
                            continue;
                        }

                        // Add line
                        Debug.DrawLine(node.Pos, current.Pos, colour);
                    }
                }
            }
        }