// Constructor private PathFindingGUI() : base("A* Path finding") { _pathFinding = Factory.CreatePathFindingObject(_width / CellSize, _height / CellSize, CellSize, _startPoint); pathNodes = _pathFinding.FindPath(StartX, StartY, EndX, EndY); _wallManagement = (IWallManagement)_pathFinding; OnSpacePressed += Events.TestOnSpace; OnWKeyPressed += Events.TestOnWKey; OnSKeyPressed += Events.TestOnSKey; OnEKeyPressed += Events.TestOnEKey; }
// Reset the the window name, width and height. public override void ResetGUI(string name, int width, int height) { _width = width; _height = height; if (window != null) { window.Close(); } window = Factory.CreateNewWindow(name, _width, _height); _startPoint = Factory.CreatePoint(0, 0); StartX = _width / 10 / CellSize; StartY = _height / 2 / CellSize; EndX = _width / CellSize - StartX; EndY = _height / 2 / CellSize; _pathFinding = Factory.CreatePathFindingObject(_width / CellSize, _height / CellSize, CellSize, _startPoint); _wallManagement = (IWallManagement)_pathFinding; pathNodes = _pathFinding.FindPath(StartX, StartY, EndX, EndY); }