void PathFind(int startX, int startY, int endX, int endY) { ResetPath(); GraphSearch mSearch = new GraphSearch(mTileMap.MapInfo.mGraph); mSearch.PathFind(startX, startY, endX, endY); if (mSearch.IsFound()) { mPath = mSearch.GetPathList(); } if (mPath != null) { foreach (Node i in mPath) { if (mTileMap.MapInfo.GetTileTypeIndex(i.mIndex) == DTileMap.TileType.Walkable) { mTileMap.MapInfo.SetTileTypeIndex(i.mIndex, DTileMap.TileType.Path, true); } } if (gameObject.renderer.enabled == true) { mTileMap.MapInfo.SetTileTypeIndex(mPath[0].mIndex, mPlayerIndex, true); } } }
//Path Find Parts List <Node> PathFind(int startX, int startY, int endX, int endY) { List <Node> Path = null; GraphSearch mSearch = new GraphSearch(mTileMap.MapInfo.mGraph); mSearch.PathFind(startX, startY, endX, endY); if (mSearch.IsFound()) { //mCloseList = mSearch.GetCloseList(); Path = mSearch.GetPathList(); //foreach(Node i in Path) //{ // mTileMap.MapInfo.SetTileTypeIndex(i.mIndex,DTileMap.TileType.Path); //} } else { Debug.Log("No Path is found"); } return(Path); }