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