방향성(4방향) 수정

This commit is contained in:
김민구
2020-12-16 11:19:51 +09:00
parent 1d32355668
commit 7c35e8febd
7 changed files with 17 additions and 1 deletions

View File

@@ -226,7 +226,8 @@ namespace AStarPathFinding
for (int i = 0; i < 8; i++)
{
// 방향성 초기 값
Form1.Direction = "Up";
Form1.Direction = "Down";
AstarNode openNode;
@@ -386,6 +387,21 @@ namespace AStarPathFinding
continue;
}
if (tableStateData[tempChildAxis.X, tempChildAxis.Y] == eTileState.DRoad & Form1.Direction == "Down")
{
openNode = tableNodeData[tempChildAxis.X, tempChildAxis.Y];
openNode.SetParent(focusNode);
openNode.SetGCost(gCost + openNode.parent.D);
openNode.SetHCost(openNode.parent.D - 1000); // 휴리스틱 값 수정해서 길 따라갈 수 있게 점수를 낮춰줌 수정
openNode.ParentDirection = neerAxis[i];
dicOpenList.Add(tempChildAxis, openNode);
tableStateData[tempChildAxis.X, tempChildAxis.Y] = eTileState.Open;
continue;
}
////대각선일시 자신의 주변을 체크 후 벽이있다면 무시한다(벽끼고 대각선이동 불가)
//if (gCost == 14)
//{