#include <PathFinderComponent.hpp>
Public Member Functions | |
PathFinderComponent (int *newTileMap) | |
construct the pathfinder component with the given tilemap (reference) More... | |
~PathFinderComponent () | |
void | check_neighbor_bound (int *m_Tiles, std::vector< Move_n_cost > &neighbors, int TILE_MAP_ROW, int TILE_MAP_COL, Position local, Position neighbor, bool diagonal) |
check if going to a neighbor is valid and record the move cost More... | |
std::vector< Move_n_cost > | get_neighbors (int *m_Tiles, Position local, int data_height, int data_width) |
get all valid neighbors of a given tile More... | |
void | find_path (int *m_Tiles, std::unordered_map< Position, Position > &came_from, Position start, Position end) |
plan the path between start and end, and stores the moves into a vector More... | |
void | reconstruct_path (int *m_Tiles, std::unordered_map< Position, Position > &came_from, Position start, Position end) |
write down the path lines to a vector More... | |
void | PrintMap (int *PathMap) |
debugger for viewing map More... | |
void | DrawDebugPath (SDL_Renderer *ren, int enemyCamX, int enemyCamY) |
a visual debugger that draw red squres on the path More... | |
void | PlanPath (Position start, Position end) |
trigger the functions that generate paths More... | |
bool | arriveTarget (Position currPos) |
determines if the target is arrived at More... | |
Position | GetNewDirection (Position curr_grid, Position curr_coord) |
get the moving direction in order to move the object on the path More... | |
Position | SeeNextTarget () |
get the next target for distance checking More... | |
Public Member Functions inherited from Component | |
Component () | |
~Component () | |
|
inline |
construct the pathfinder component with the given tilemap (reference)
|
inline |
bool PathFinderComponent::arriveTarget | ( | Position | currPos | ) |
determines if the target is arrived at
void PathFinderComponent::check_neighbor_bound | ( | int * | m_Tiles, |
std::vector< Move_n_cost > & | neighbors, | ||
int | TILE_MAP_ROW, | ||
int | TILE_MAP_COL, | ||
Position | local, | ||
Position | neighbor, | ||
bool | diagonal | ||
) |
check if going to a neighbor is valid and record the move cost
void PathFinderComponent::DrawDebugPath | ( | SDL_Renderer * | ren, |
int | enemyCamX, | ||
int | enemyCamY | ||
) |
a visual debugger that draw red squres on the path
void PathFinderComponent::find_path | ( | int * | m_Tiles, |
std::unordered_map< Position, Position > & | came_from, | ||
Position | start, | ||
Position | end | ||
) |
plan the path between start and end, and stores the moves into a vector
std::vector< Move_n_cost > PathFinderComponent::get_neighbors | ( | int * | m_Tiles, |
Position | local, | ||
int | data_height, | ||
int | data_width | ||
) |
get all valid neighbors of a given tile
get the moving direction in order to move the object on the path
trigger the functions that generate paths
void PathFinderComponent::PrintMap | ( | int * | PathMap | ) |
debugger for viewing map
void PathFinderComponent::reconstruct_path | ( | int * | m_Tiles, |
std::unordered_map< Position, Position > & | came_from, | ||
Position | start, | ||
Position | end | ||
) |
write down the path lines to a vector
Position PathFinderComponent::SeeNextTarget | ( | ) |
get the next target for distance checking