Refactored the pathfind function to move it from the BattleScene to the Grid object.