human add movement

This commit is contained in:
aozhiwei 2019-06-07 22:59:32 +08:00
parent 7515adebae
commit d52daccd94
2 changed files with 7 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include "app.h" #include "app.h"
#include "roommgr.h" #include "roommgr.h"
#include "android.h" #include "android.h"
#include "movement.h"
#include "framework/cpp/utils.h" #include "framework/cpp/utils.h"
#include "framework/cpp/httpclientpool.h" #include "framework/cpp/httpclientpool.h"
@ -50,6 +51,8 @@ Human::Human():Entity()
Human::~Human() Human::~Human()
{ {
delete movement ;
movement = nullptr;
} }
void Human::Initialize() void Human::Initialize()
@ -59,6 +62,8 @@ void Human::Initialize()
RecalcSelfCollider(); RecalcSelfCollider();
volume_ = meta->volume; volume_ = meta->volume;
observers_.insert(this); observers_.insert(this);
movement = new MovementComponent();
movement->owner = this;
} }
float Human::GetSpeed() float Human::GetSpeed()

View File

@ -30,6 +30,7 @@ enum HumanStatus
struct xtimer_list; struct xtimer_list;
class CircleCollider; class CircleCollider;
class Obstacle; class Obstacle;
class MovementComponent;
class Human : public Entity class Human : public Entity
{ {
public: public:
@ -219,6 +220,7 @@ protected:
std::set<Human*> observers_; std::set<Human*> observers_;
Human* follow_target_ = nullptr; Human* follow_target_ = nullptr;
bool follow_synced_active_player = false; bool follow_synced_active_player = false;
MovementComponent* movement = nullptr;
private: private:
CircleCollider* self_collider_ = nullptr; CircleCollider* self_collider_ = nullptr;