Пример #1
0
        public void InitialiseGraph(int CellsUp, int CellsAcross, int pWidth, int pHeight)
        {
            m_iCellsX = CellsAcross;
            m_iCellsY = CellsUp;

            m_icxClient = pWidth;
            m_icyClient = pHeight;

            //initialize the terrain vector with normal terrain
            int numNodes = CellsUp * CellsAcross;

            m_TerrainType = new List <int>(numNodes);

            for (int i = 0; i < numNodes; i++)
            {
                m_TerrainType.Add((int)brush_type.normal);
            }

            m_Path    = new List <int>();
            m_SubTree = new List <NavGraphEdge>();

            m_dCellWidth  = (double)m_icxClient / (double)CellsAcross;
            m_dCellHeight = (double)m_icyClient / (double)CellsUp;

            //create the graph
            m_Graph = new SparseGraph(false);//not a digraph

            SparseGraph.Helper_CreateGrid(m_Graph, m_icxClient, m_icyClient, CellsUp, CellsAcross);

            m_CurrentAlgorithm = algorithm_type.none;
            m_dTimeTaken       = 0;
        }