aozhiwei e70e3b335e 1
2021-03-16 16:52:06 +08:00

52 lines
1.6 KiB
C++

#pragma once
class Entity;
class Human;
class Bullet;
class Room;
class Car;
class Hero;
class GridCell
{
public:
GridCell();
void ClearRoomData(Room* room);
void AddHuman(Human* hum);
void RemoveHuman(Human* hum);
bool ExistsHuman(Human* hum);
void TouchHumanList(std::function<void (Human*, bool&)>& func,
int room_idx,
bool& stop);
void TouchHumanListEx(std::function<void (Human*, bool&)> func,
int room_idx,
bool& stop);
void AddBullet(Bullet* bullet);
void RemoveBullet(Bullet* bullet);
void AddCar(Car* car);
void RemoveCar(Car* car);
void AddHero(Hero* hero);
void RemoveHero(Hero* hero);
void AddPermanentEntity(Entity* entity);
void AddRoomEntity(Room* room, Entity* entity);
void RemoveRoomEntity(Room* room, Entity* entity);
bool ExistsEntity(Room* room, Entity* Entity);
void TouchLayer0EntityList(std::function<void (Entity*, bool&)>& func,
bool& stop);
void TouchLayer1EntityList(std::function<void (Entity*, bool&)>& func,
int room_idx,
bool& stop);
void TouchAllLayerEntityList(std::function<void (Entity*, bool&)>& func,
int room_idx,
bool& stop);
private:
std::vector<std::set<Human*>> human_list_;
std::vector<std::set<Entity*>> entity_list_;
std::vector<std::set<Bullet*>> bullet_list_;
std::vector<std::set<Car*>> car_list_;
std::vector<std::set<Hero*>> hero_list_;
};