protected override void FindPath() { this.m_TargetObjectPosition = this.m_TargetInfo.ActorPosition; List <TilePosition> border = BorderPointHelper.GetInflateOneBorder(this.m_TargetInfo); if (border.Contains(this.m_PreviousPosition - this.m_TargetObjectPosition)) { this.m_TargetPosition = this.m_PreviousPosition; this.OnTargetReached(); } else { List <TilePosition> aStarPath = AStarPathFinder.CalculateAStarPahtTile (this.FindPathStrategy, this.m_PreviousPosition, this.m_TargetPosition); this.m_LinePath.Clear(); int destinationIndex = aStarPath.Count - 1; for (int i = destinationIndex - 1; i >= 0; i--) { TilePosition position = aStarPath[i]; if (border.Contains(position - this.m_TargetObjectPosition)) { destinationIndex = i; break; } } this.m_TargetPosition = aStarPath[destinationIndex]; for (int i = 1; i <= destinationIndex; i++) { TilePosition astarPoint = aStarPath[i]; this.m_LinePath.Enqueue(astarPoint); } } }
protected override void FindPath() { List <TilePosition> aStarPath = AStarPathFinder.CalculateAStarPahtTile (this.FindPathStrategy, this.m_PreviousPosition, this.m_TargetPosition); this.m_LinePath.Clear(); for (int i = 1; i < aStarPath.Count; i++) { TilePosition astarPoint = aStarPath[i]; this.m_LinePath.Enqueue(astarPoint); } }