-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactory.cs
More file actions
28 lines (23 loc) · 1.02 KB
/
Factory.cs
File metadata and controls
28 lines (23 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using SplashKitSDK;
namespace MyPathFinding{
// This is a factory class which creates object of class that is need in classes in the program
// without using new keyword.
public static class Factory{
// Creates an a star object for IFindPath interface.
public static IFindPath<PathNode> CreatePathFindingObject(int width, int height, int cellSize, Point2D startPoint){
return new AStartPathFinding(width, height, cellSize, startPoint);
}
// Creates a window object.
public static Window CreateNewWindow(string name, int width, int height){
return new Window(name, width, height);
}
// Creates a point with given x and y.
public static Point2D CreatePoint(int x, int y){
return new Point2D(){X=x, Y=y};
}
// Creates a path node object.
public static PathNode CreatePathNode(Grid<PathNode> grid, int x, int y){
return new PathNode(grid, x, y);
}
}
}