1
This commit is contained in:
parent
d49d2f67fc
commit
6aebffe95b
@ -3178,15 +3178,11 @@ void Creature::UpdateMove()
|
|||||||
{
|
{
|
||||||
if (GetMovement()->UpdatePosition()) {
|
if (GetMovement()->UpdatePosition()) {
|
||||||
} else {
|
} else {
|
||||||
#if 0
|
if (!GetMovement()->IsFindPath()) {
|
||||||
GetMovement()->CalcTargetPos(500);
|
GetMovement()->CalcTargetPos(100);
|
||||||
if (GetMovement()->GetMovePosition(out_pos)) {
|
if (GetMovement()->UpdatePosition()) {
|
||||||
a8::Vec2 new_pos;
|
}
|
||||||
new_pos.x = out_pos.x;
|
|
||||||
new_pos.y = out_pos.z;
|
|
||||||
//SetPos(new_pos);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
room->grid_service->MoveCreature(this);
|
room->grid_service->MoveCreature(this);
|
||||||
CheckSpecObject();
|
CheckSpecObject();
|
||||||
|
@ -20,6 +20,7 @@ bool Movement::UpdatePosition()
|
|||||||
{
|
{
|
||||||
if (path_index_ >= paths_.size()) {
|
if (path_index_ >= paths_.size()) {
|
||||||
ClearPath();
|
ClearPath();
|
||||||
|
is_find_path_ = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MovePathPoint& curr_point = paths_[path_index_];
|
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);
|
paths_.push_back(p);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
is_find_path_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Movement::GetPathSize()
|
size_t Movement::GetPathSize()
|
||||||
|
@ -23,9 +23,11 @@ class Movement
|
|||||||
void ClearPath();
|
void ClearPath();
|
||||||
void AddPaths(const a8::Vec3& start, std::vector<a8::Vec3>& paths);
|
void AddPaths(const a8::Vec3& start, std::vector<a8::Vec3>& paths);
|
||||||
size_t GetPathSize();
|
size_t GetPathSize();
|
||||||
|
bool IsFindPath() { return is_find_path_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<MovePathPoint> paths_;
|
std::vector<MovePathPoint> paths_;
|
||||||
int path_index_ = 0;
|
int path_index_ = 0;
|
||||||
Creature* owner_ = nullptr;
|
Creature* owner_ = nullptr;
|
||||||
|
bool is_find_path_ = false;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user