1. 방향성 생성 및 중간에 길이 크로스 될때 들어갈 수 있는 기능 구현 중
2. 4방향 설정 추가
This commit is contained in:
42
Form1.cs
42
Form1.cs
@@ -13,7 +13,7 @@ namespace AStarPathFinding
|
||||
//타일 속성
|
||||
//기본, 출발점, 목적지, 벽, 열린리스트, 닫힌리스트, 길
|
||||
public enum eTileState
|
||||
{ None, Start, Goal, Wall, Road, RRoad, LRoad, Open, Close, Path }
|
||||
{ None, Start, Goal, Wall, Road, RRoad, LRoad, URoad, DRoad, Open, Close, Path }
|
||||
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
@@ -195,6 +195,12 @@ namespace AStarPathFinding
|
||||
case eTileState.RRoad:
|
||||
color = Color.DarkBlue;
|
||||
break;
|
||||
case eTileState.URoad:
|
||||
color = Color.Bisque;
|
||||
break;
|
||||
case eTileState.DRoad:
|
||||
color = Color.BlueViolet;
|
||||
break;
|
||||
}
|
||||
DrawNode(e, color, pathFinder.GetAstarNode(new Point(i, j)));
|
||||
}
|
||||
@@ -239,6 +245,16 @@ namespace AStarPathFinding
|
||||
SetCurrentAction(sender, eTileState.RRoad);
|
||||
}
|
||||
|
||||
private void btn_SetUpRoadPoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetCurrentAction(sender, eTileState.URoad);
|
||||
}
|
||||
|
||||
private void btn_SetDownRoadPoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetCurrentAction(sender, eTileState.DRoad);
|
||||
}
|
||||
|
||||
private void pn_Table_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
int x = e.X / tableNodeSize;
|
||||
@@ -320,6 +336,30 @@ namespace AStarPathFinding
|
||||
}
|
||||
|
||||
tableData[x, y] = eTileState.RRoad;
|
||||
break;
|
||||
case eTileState.URoad:
|
||||
if (tableData[x, y] == eTileState.Start || tableData[x, y] == eTileState.Goal)
|
||||
break;
|
||||
|
||||
if (tableData[x, y] == eTileState.URoad)
|
||||
{
|
||||
tableData[x, y] = eTileState.None;
|
||||
break;
|
||||
}
|
||||
|
||||
tableData[x, y] = eTileState.URoad;
|
||||
break;
|
||||
case eTileState.DRoad:
|
||||
if (tableData[x, y] == eTileState.Start || tableData[x, y] == eTileState.Goal)
|
||||
break;
|
||||
|
||||
if (tableData[x, y] == eTileState.DRoad)
|
||||
{
|
||||
tableData[x, y] = eTileState.None;
|
||||
break;
|
||||
}
|
||||
|
||||
tableData[x, y] = eTileState.DRoad;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user