]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/Entity.cpp
added entity follower list
[l2e.git] / src / map / Entity.cpp
index b9fba9797acc17246783793dac4cc4dfdf8ed1d1..08be97b96c93208ab95774ed4168377e02cc007d 100644 (file)
@@ -12,7 +12,8 @@ using geometry::Vector;
 namespace map {
 
 Entity::Entity()
-: animation(0)
+: follower(0)
+, animation(0)
 , orientation(ORIENTATION_NORTH)
 , speed(0) {
        runner.SetFrameShift(1);
@@ -30,6 +31,34 @@ void Entity::SetSpeed(float s) {
        UpdateVelocity();
 }
 
+void Entity::StartAnimation(app::Application &ctrl) {
+       runner.Start(ctrl);
+}
+
+void Entity::StartAnimation(app::State &ctrl) {
+       runner.Start(ctrl);
+}
+
+void Entity::StopAnimation() {
+       runner.Stop();
+}
+
+void Entity::AddFollower(Entity *f) {
+       if (follower) {
+               follower->AddFollower(f);
+       } else {
+               follower = f;
+       }
+}
+
+void Entity::RemoveFollower(Entity *f) {
+       if (follower == f) {
+               follower = follower->follower;
+       } else if (follower) {
+               follower->RemoveFollower(f);
+       }
+}
+
 void Entity::SetAnimation(const graphics::Animation *a) {
        animation = a;
        runner.ChangeAnimation(animation);