1
This commit is contained in:
parent
a6cf2728fe
commit
646cbf5e2c
@ -230,3 +230,21 @@ int MapService::GetGridId(float world_x, float world_y)
|
||||
int grid_id = (int)(world_x/cell_width_) + (int)(world_y/cell_width_) * map_width_;
|
||||
return grid_id;
|
||||
}
|
||||
|
||||
int MapService::FindPathRequest(Human* hum,
|
||||
const a8::Vec2& start_pos,
|
||||
const a8::Vec2& end_pos,
|
||||
int max_step_num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FindPathStatus* MapService::QueryFindPathStatus(int query_id)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MapService::RemoveFindPathRequest(Human* hum, int query_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class Human;
|
||||
class ColliderComponent;
|
||||
|
||||
struct CellNode
|
||||
@ -9,6 +10,23 @@ struct CellNode
|
||||
CellNode* next = nullptr;
|
||||
};
|
||||
|
||||
struct MovePathPoint
|
||||
{
|
||||
a8::Vec2 pos;
|
||||
float distance = 0;
|
||||
};
|
||||
|
||||
struct FindPathStatus
|
||||
{
|
||||
long long frameno = 0;
|
||||
Human* hum = nullptr;
|
||||
a8::Vec2 start_pos;
|
||||
a8::Vec2 end_pos;
|
||||
int curr_step = 0;
|
||||
int max_step_num = 0;
|
||||
std::vector<MovePathPoint> out_ponits;
|
||||
};
|
||||
|
||||
class Room;
|
||||
class MapService
|
||||
{
|
||||
@ -25,6 +43,12 @@ class MapService
|
||||
float world_x,
|
||||
float world_y,
|
||||
std::set<ColliderComponent*>& colliders);
|
||||
int FindPathRequest(Human* hum,
|
||||
const a8::Vec2& start_pos,
|
||||
const a8::Vec2& end_pos,
|
||||
int max_step_num);
|
||||
FindPathStatus* QueryFindPathStatus(int query_id);
|
||||
void RemoveFindPathRequest(Human* hum, int query_id);
|
||||
|
||||
private:
|
||||
int GetGridId(float world_x, float world_y);
|
||||
|
Loading…
x
Reference in New Issue
Block a user