【性能】getaround 统一从 areamanager获取

main
刘涛 2024-10-22 12:30:04 +08:00
parent 01e9dc3a74
commit f4f1e6c48f
3 changed files with 3 additions and 2 deletions

View File

@ -295,7 +295,7 @@ namespace Gameplay.Area
moveCellList.Add(lastValue);
// 把周围的格子加入到工作列表
var aroundList = map.TerrainGridSystem.CellGetNeighboursWithinRange(lastValue, 0, 1, canCrossCheckType: TGS.CanCrossCheckType.IgnoreCanCrossCheckOnAllCells);
var aroundList = AreaManager.instance.GetCellIndexsAround(lastValue, 1, false);
for (int i = 0; i < aroundList.Count; i++)
{
var cellIndex = aroundList[i];

View File

@ -216,7 +216,7 @@ namespace Gameplay
// 无法到达
// 获得附近一圈的格子
var nearByCells = map.TerrainGridSystem.CellGetNeighboursWithinRange(from, 1, 1);
var nearByCells = AreaManager.instance.GetCellIndexsAround(from, 1, false);
if (nearByCells == null || nearByCells.Count <= 0) return false;
// 取最近的格子
int closestCell = -1;

View File

@ -115,6 +115,7 @@ namespace Gameplay.Vehicle.State
var searchResult = new List<int>();
for (int i = 0; i < maxSearchRange; i++)
{
// TODO: 只有这里用到了这个方法
var aroundList = map.TerrainGridSystem.CellGetNeighboursWithinRange(centerCellIndex, i, i + 1, includeInvisibleCells: false,
canCrossCheckType: CanCrossCheckType.Default);
for (int j = 0; j < aroundList.Count; j++)