add walk zone

This commit is contained in:
aozhiwei 2019-06-11 09:24:50 +08:00
parent d9b4ce5554
commit 5669d2d156
2 changed files with 4 additions and 7 deletions

View File

@ -29,6 +29,7 @@ enum HumanStatus
struct xtimer_list;
class CircleCollider;
class AabbCollider;
class Obstacle;
class Human : public Entity
{
@ -219,6 +220,9 @@ protected:
std::set<Human*> observers_;
Human* follow_target_ = nullptr;
bool follow_synced_active_player = false;
AabbCollider* walk_zone = nullptr;
std::set<ColliderComponent*> seen_colliders;
ColliderComponent* last_collider = nullptr;
private:
CircleCollider* self_collider_ = nullptr;

View File

@ -120,17 +120,10 @@ void Player::UpdateMove()
pos = pos + move_dir;
if (IsCollision()) {
pos = old_pos;
#if 1
FindPath();
if (rand() % 3 == 0) {
i += 1;
}
#else
if (i == 0) {
FindPath();
}
break;
#endif
}
room->grid_service.MoveHuman(this);
}