54 lines
2.0 KiB
C++
54 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "gridservice.h"
|
|
#include "roomentity.h"
|
|
|
|
class AIComponent;
|
|
class MoveableEntity : public RoomEntity
|
|
{
|
|
public:
|
|
AIComponent* ai = nullptr;
|
|
|
|
virtual void Update(int delta_time) {};
|
|
int UpdatedTimes() { return updated_times_;}
|
|
std::set<GridCell*>& GetGridList() { return grid_list_; }
|
|
|
|
void TraverseCreatures(std::function<void (Creature*, bool&)> func);
|
|
void TraverseAllLayerEntityList(std::function<void (Entity*, bool&)> func);
|
|
void TraverseAllLayerHumanList(std::function<void (Human*, bool&)> func);
|
|
|
|
virtual void RefreshView();
|
|
virtual void OnGridListChange(std::set<GridCell*>& old_grids,
|
|
std::set<GridCell*>& inc_grids,
|
|
std::set<GridCell*>& dec_grids
|
|
);
|
|
virtual void SyncAroundPlayers(const char* file, int line, const char* func);
|
|
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_; };
|
|
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_; }
|
|
void CalcTargetPos(float distance);
|
|
|
|
protected:
|
|
int updated_times_ = 0;
|
|
|
|
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;
|
|
int chg_attack_dir_times_ = 0;
|
|
int chg_target_pos_times_ = 0;
|
|
};
|