This commit is contained in:
aozhiwei 2022-11-29 19:10:54 +08:00
parent 89aa344e9c
commit aa13b56d2a
2 changed files with 11 additions and 0 deletions

View File

@ -90,6 +90,12 @@ void MoveableEntity::SetMoveDir(const a8::Vec2& move_dir)
++chg_move_dir_times_;
}
void MoveableEntity::SetTargetPos(const a8::Vec3& target_pos)
{
target_pos_ = target_pos;
++chg_target_pos_times_;
}
void MoveableEntity::SetAttackDir(const a8::Vec2& attack_dir)
{
attack_dir_ = attack_dir;

View File

@ -26,12 +26,15 @@ 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 a8::Vec3& GetTargetPos() { return target_pos_; };
virtual void SetTargetPos(const a8::Vec3& target_pos);
virtual const a8::Vec2& GetAttackDir() { return attack_dir_; };
virtual void SetAttackDir(const a8::Vec2& attack_dir);
virtual const a8::Vec2& GetShotDir() { return attack_dir_; };
int GetChgMoveDirTimes() { return chg_move_dir_times_; }
int GetChgAttackDirTimes() { return chg_attack_dir_times_; }
float GetAttackDirRotate();
int GetChgTargetPosTimes() { return chg_target_pos_times_; }
protected:
int updated_times_ = 0;
@ -39,7 +42,9 @@ protected:
private:
a8::Vec2 move_dir_;
a8::Vec2 attack_dir_;
a8::Vec3 target_pos_;
std::set<GridCell*> grid_list_;
int chg_move_dir_times_ = 0;
int chg_attack_dir_times_ = 0;
int chg_target_pos_times_ = 0;
};