X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FEntity.cpp;h=08be97b96c93208ab95774ed4168377e02cc007d;hb=a1c89e41e38eca790e168b8acd3beee974685fcd;hp=b9fba9797acc17246783793dac4cc4dfdf8ed1d1;hpb=7b70f3c1609fb2b783bd932280c98dbc44f5f746;p=l2e.git diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index b9fba97..08be97b 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -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);