This commit is contained in:
aozhiwei 2022-12-28 11:11:09 +08:00
parent d49d2f67fc
commit 6aebffe95b
3 changed files with 8 additions and 8 deletions

View File

@ -3178,15 +3178,11 @@ void Creature::UpdateMove()
{
if (GetMovement()->UpdatePosition()) {
} else {
#if 0
GetMovement()->CalcTargetPos(500);
if (GetMovement()->GetMovePosition(out_pos)) {
a8::Vec2 new_pos;
new_pos.x = out_pos.x;
new_pos.y = out_pos.z;
//SetPos(new_pos);
if (!GetMovement()->IsFindPath()) {
GetMovement()->CalcTargetPos(100);
if (GetMovement()->UpdatePosition()) {
}
}
#endif
}
room->grid_service->MoveCreature(this);
CheckSpecObject();

View File

@ -20,6 +20,7 @@ bool Movement::UpdatePosition()
{
if (path_index_ >= paths_.size()) {
ClearPath();
is_find_path_ = false;
return false;
}
MovePathPoint& curr_point = paths_[path_index_];
@ -269,6 +270,7 @@ void Movement::AddPaths(const a8::Vec3& start, std::vector<a8::Vec3>& paths)
paths_.push_back(p);
}
#endif
is_find_path_ = true;
}
size_t Movement::GetPathSize()

View File

@ -23,9 +23,11 @@ class Movement
void ClearPath();
void AddPaths(const a8::Vec3& start, std::vector<a8::Vec3>& paths);
size_t GetPathSize();
bool IsFindPath() { return is_find_path_; }
private:
std::vector<MovePathPoint> paths_;
int path_index_ = 0;
Creature* owner_ = nullptr;
bool is_find_path_ = false;
};