1
This commit is contained in:
parent
9ab88172ac
commit
57b0c9db44
@ -2019,8 +2019,12 @@ void Human::_UpdateMove(int speed)
|
||||
if (HasBuffEffect(kBET_Hide)) {
|
||||
RemoveBuffByEffectId(kBET_Hide);
|
||||
}
|
||||
a8::Vec2 old_pos = GetPos();
|
||||
SetPos(old_pos + GetMoveDir() * speed);
|
||||
a8::Vec2 curr_pos;
|
||||
curr_pos.x = GetLastPos().x;
|
||||
curr_pos.y = GetLastPos().z;
|
||||
|
||||
SetPos(GetPos() + GetMoveDir() * speed);
|
||||
|
||||
CheckSpecObject();
|
||||
}
|
||||
#else
|
||||
|
@ -132,12 +132,15 @@ void MoveableEntity::CalcTargetPos(float distance)
|
||||
glm::vec3 end;
|
||||
glm::vec3 hit_point;
|
||||
|
||||
start.x = GetPos().x / 10;
|
||||
start.z = GetPos().y / 10;
|
||||
start.x = GetPos().x / 10.0f;
|
||||
start.z = GetPos().y / 10.0f;
|
||||
|
||||
a8::Vec2 target_pos2d = GetPos() + GetMoveDir() * distance;
|
||||
end.x = target_pos2d.x / 10;
|
||||
end.z = target_pos2d.y / 10;
|
||||
end.x = target_pos2d.x / 10.0f;
|
||||
end.z = target_pos2d.y / 10.0f;
|
||||
|
||||
last_pos_.x = GetPos().x;
|
||||
last_pos_.z = GetPos().y;
|
||||
|
||||
int ret = room->map_instance->Raycast(0, start, end, hit_point);
|
||||
if (ret > 1) {
|
||||
|
@ -26,6 +26,7 @@ class MoveableEntity : public RoomEntity
|
||||
virtual void UpdateCharImage(const char* file, int line, const char* func);
|
||||
virtual const a8::Vec2& GetMoveDir() { return move_dir_; };
|
||||
virtual void SetMoveDir(const a8::Vec2& move_dir);
|
||||
virtual const glm::vec3& GetLastPos() { return last_pos_; };
|
||||
virtual const glm::vec3& GetTargetPos() { return target_pos_; };
|
||||
virtual void SetTargetPos(const glm::vec3& target_pos);
|
||||
virtual const a8::Vec2& GetAttackDir() { return attack_dir_; };
|
||||
@ -43,6 +44,7 @@ protected:
|
||||
private:
|
||||
a8::Vec2 move_dir_;
|
||||
a8::Vec2 attack_dir_;
|
||||
glm::vec3 last_pos_;
|
||||
glm::vec3 target_pos_;
|
||||
std::set<GridCell*> grid_list_;
|
||||
int chg_move_dir_times_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user