game2005/server/gameserver/moveableentity.h
2021-03-17 11:46:10 +08:00

35 lines
1.1 KiB
C++

#pragma once
#include "gridservice.h"
#include "roomentity.h"
class AIComponent;
class MoveableEntity : public RoomEntity
{
public:
a8::Vec2 move_dir;
AIComponent* ai = nullptr;
virtual void Update(int delta_time) {};
int UpdatedTimes() { return updated_times_;}
std::set<GridCell*>& GetGridList() { return grid_list_; }
void TouchLayer0EntityList(std::function<void (Entity*, bool&)> func);
void TouchLayer1EntityList(std::function<void (Entity*, bool&)> func);
void TouchAllLayerEntityList(std::function<void (Entity*, bool&)> func);
void TouchAllLayerHumanList(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);
protected:
int updated_times_ = 0;
private:
std::set<GridCell*> grid_list_;
};