Exemplo n.º 1
0
        public void Insert(Node node)
        {
            if(m_Rect.width > minWidth) // đệ quy lần nữa
            {
                Split();

                if (m_AreaOne.isContain(node))
                    m_AreaOne.Insert(node);

                if (m_AreaTwo.isContain(node))
                    m_AreaTwo.Insert(node);

                if (m_AreaThree.isContain(node))
                    m_AreaThree.Insert(node);

                if (m_AreaFour.isContain(node))
                    m_AreaFour.Insert(node);
            }
            else
            {
                m_List.Add(node);
            }
        }
Exemplo n.º 2
0
        private void createTiledMap_Click(object sender, RoutedEventArgs e)
        {
            List<Node> list = new List<Node>();

            foreach(var item in m_ListNode)
            {
                Node temp = new Node(item.id, item.index, (int)item.x / ScaleBackGround, (int)item.y / ScaleBackGround, (int)item.rect.Width / ScaleBackGround, (int)item.rect.Height / ScaleBackGround);
                list.Add(temp);
            }

            foreach(var item in m_ListInfor)
            {
                m_Information += item + Environment.NewLine;
            }

            m_TileMap = new TileMap(list, m_Information, tileWidth, tileHeight, mapWidth, mapHeight);
            m_TileMap.CreateQuadTree();
            m_TileMap.SaveFileTileMap();
        }
Exemplo n.º 3
0
 bool isContain(Node node)
 {
     return !(node.m_X + node.m_Width < m_Rect.x || node.m_X > m_Rect.x + m_Rect.width ||
         node.m_Y + node.m_Height < m_Rect.y || node.m_Y > m_Rect.y + m_Rect.height);
 }