NodeMap for A* improvement
This commit is contained in:
parent
f4c3020cfb
commit
6877176a0a
@ -12,25 +12,30 @@ public class NodeMap : MonoBehaviour
|
||||
public float cellSize;
|
||||
public TileData[] TileDatas;
|
||||
public Dictionary<TileBase, TileData> DataFromTiles = new Dictionary<TileBase, TileData>();
|
||||
|
||||
public bool hasEverRun = false;
|
||||
public Tilemap tilemap;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
void LateUpdate()
|
||||
{
|
||||
DataFromTiles = new Dictionary<TileBase, TileData>();
|
||||
foreach (var tileData in TileDatas)
|
||||
{
|
||||
foreach (var tile in tileData.Tiles)
|
||||
if (!hasEverRun){
|
||||
DataFromTiles = new Dictionary<TileBase, TileData>();
|
||||
foreach (var tileData in TileDatas)
|
||||
{
|
||||
DataFromTiles.Add(tile, tileData);
|
||||
foreach (var tile in tileData.Tiles)
|
||||
{
|
||||
DataFromTiles.Add(tile, tileData);
|
||||
}
|
||||
}
|
||||
|
||||
hasEverRun = true;
|
||||
CreateNodes();
|
||||
TileCheck();
|
||||
}
|
||||
|
||||
|
||||
CreateNodes();
|
||||
TileCheck();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void TileCheck()
|
||||
{
|
||||
foreach (var n in nodeGrid)
|
||||
|
Loading…
Reference in New Issue
Block a user