# MapGridInUnity **Repository Path**: bugman/MapGridInUnity ## Basic Information - **Project Name**: MapGridInUnity - **Description**: https://github.com/tang-xiaolong/MapGridInUnity.git 转载方便国内方便下载 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-01-15 - **Last Updated**: 2024-01-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README English | [简体中文](./README.md)
A universal game map solution
## Main module ### Minimum heap maximum heap module This module mainly supports subsequent pathfinding algorithms. It uses the list as the actual storage container, and the list elements need to implement the `IComparable` interface. The algorithm adjusts the sorting of heap elements through the `CompareTo `method. ### Universal map module The module does this by completely separating the map data from the map display. A series of map-related interfaces are separated from the module, such as `IMapGrid `, `IMapShow`, `INode`, `IPathNode`, `INodeEntity`, etc. Each interface is responsible for defining what the implementation class should do. This module uses the interface to realize the universality of the map module. Each class in the module only depends on the method in the interface, and the type is set through the form of dependency injection. * `IMapGrid`: The common properties and necessary methods of the map data class are defined. * `IMapShow`: Defines the map display related content, such as setting the map node `GameObject`, binding the map data, getting display object and location, etc. * `INode`: Defines what a simple node should contain. * `IPathNode`: This interface implements all contents of `INode`, and on this basis adds some necessary contents of pathfinding, such as generation value, parent node, whether passable and so on. * `INodeEntity`: Defines display interfaces for nodes, such as highlighting, restoring, and so on. ### Pathfinding module This module contains the A star pathfinding algorithm and optimized minimum heap of A star algorithm in the optimization algorithm, the introduction of the minimum heap to quickly remove the minimum cost of the node from the Open list, introducing the SessionId to speed the list if the node in the Open and Close the list of judgment. ## Gif example ### Create map generate configuration  ### Create Map  ### Whether the map starting point needs to be offset  ### Pathfinding  ### Map highlighting  ## Example figure ### The grid in the highlighted range of a hexagon map  ### The hexagon map highlights the grid in the specified direction  ### The Hexagonal map highlights the grid within the sector  ### The grid in the highlighted range of the grid map  ### The grid map highlights the grid in the specified direction  ### Grids in the highlighted sector of the grid map  ### Hexagonal map pathfinding  ### Four direction grid map pathfinding  ### Eight direction grid map pathfinding  ## Road map - [ ] Added structure class diagram for map module. - [ ] Take apart the entire module via blog or video. - [ ] Added pathfinding algorithm test scenario. - [ ] Added a TileMap example. - [ ] Map editor based on Unity UI Elements.