This commit is contained in:
aozhiwei 2019-09-12 11:27:30 +08:00
parent 9cf6a340f2
commit 6304a76047

View File

@ -797,37 +797,11 @@ void Room::FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCo
new_x = pos.x;
new_y = pos.y;
Entity* building = nullptr;
std::set<GridCell*> new_grid_list;
grid_service.GetAllCellsByXy(pos.x, pos.y, new_grid_list);
for (auto& grid : new_grid_list) {
for (Entity* entity : grid->entity_list) {
switch (entity->entity_type) {
case ET_Building:
{
if (entity->TestCollisionEx(pos, *aabb_box)) {
building = entity;
}
}
break;
default:
break;
}
if (building) {
break;
}
}
if (building) {
break;
}
}
if (!building) {
bool is_collision = false;
std::set<ColliderComponent*> colliders;
map_service.GetColliders(pos.x, pos.y, colliders);
for (ColliderComponent* collider : colliders) {
if (collider->IntersectEx(pos, &target_collider)) {
if (collider->IntersectEx(pos, aabb_box)) {
is_collision = true;
break;
}
@ -836,7 +810,6 @@ void Room::FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCo
break;
}
}
}
}
void Room::FillSMUiUpdate(cs::SMUiUpdate& msg)