コード例 #1
0
 public PathBuilder()
 {
     map = new int[0, 0];
     path = new AIpath();
     startPoint = new Vector2(0);
     endPoint = new Vector2(0);
     doneBuilding = false;
 }
コード例 #2
0
 public void HighlightPath(AIpath path)
 {
     Vector2 v;
     for (int i = 0; i < path.LENGTH; i++)
     {
         v = path.GetCoordinate(i);
         map[(int)v.X, (int)v.Y].UpDateColor(Color.CornflowerBlue);
     }
 }
コード例 #3
0
 public PathBuilder(int[,] map, Vector2 start, Vector2 end)
 {
     path = new AIpath();
     this.map = map;
     startPoint = start;
     endPoint = end;
     doneBuilding = false;
     mapDemendions.X = map.GetLength(0);
     mapDemendions.Y = map.GetLength(1);
 }
コード例 #4
0
        public void BuildPath()
        {
            path = new AIpath();
            currentPoint = endPoint;
            path.AddCoordinates(currentPoint);

            while (!doneBuilding)
            {
                Vector2 nextPoint = FindNextCoordinate();
                if (nextPoint == startPoint)
                {
                    path.AddCoordinates(nextPoint);
                    doneBuilding = true;
                }
                else
                {
                    path.AddCoordinates(nextPoint);
                    currentPoint = nextPoint;
                }
            }

            doneBuilding = false;
        }
コード例 #5
0
 public PathBuilder(Vector2[] pathCoordinates)
 {
     path = new AIpath(pathCoordinates);
     doneBuilding = true;
 }