Example #1
0
        public void PaintPath(List <int> path)
        {
            if (path == null)
            {
                MessageBox.Show("No path availible");
            }
            else
            {
                for (int y = 0; y < 64; y++)
                {
                    for (int x = 0; x < 64; x++)
                    {
                        int nodeInt = path[x + y * 64];
                        if (nodeInt != -1)
                        {
                            m_map[x, y] = 4;//Path bit

                            Horizontal.Start();
                            Vertical.Start();
                        }
                    }
                }
                int endNodeFrom = path[m_endPosX + 64 * m_endPosY];
                m_map[m_endPosX, m_endPosY] = 5;
                int newNodeFrom = path[endNodeFrom];
                while (path[newNodeFrom] != (m_startPosX + 64 * m_startPosY))
                {
                    //Paint 2d map
                    m_map[newNodeFrom % 64, newNodeFrom / 64] = 5;
                    //Assign 1d array;
                    newNodeFrom = path[newNodeFrom];
                }
            }
        }