diff options
Diffstat (limited to 'src/model/Entity.hpp')
-rw-r--r-- | src/model/Entity.hpp | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/src/model/Entity.hpp b/src/model/Entity.hpp index 170f23a..eab6983 100644 --- a/src/model/Entity.hpp +++ b/src/model/Entity.hpp @@ -39,41 +39,12 @@ namespace RPGEdit { namespace Model { -class Map; - class Entity { private: - const std::string name; + std::string name; - Position pos; Direction direction; - uint64_t transitionStart = 0; - uint64_t transitionEnd = 0; - - Position translate(Direction dir, float amount) const { - Position p = pos; - - switch (dir) { - case NORTH: - p.y -= amount; - break; - - case EAST: - p.x += amount; - break; - - case SOUTH: - p.y += amount; - break; - - case WEST: - p.x -= amount; - } - - return p; - } - public: Entity(const std::string &name0) : name(name0), direction(NORTH) { @@ -83,29 +54,13 @@ public: return name; } - Position getPosition(uint64_t time) const { - if (hasTransition()) - if (time <= transitionStart) - return pos; - else if (time >= transitionEnd) - return translate(direction, 1); - else - return translate(direction, float(time-transitionStart)/float(transitionEnd-transitionStart)); - else - return pos; - } - Direction getDirection() const { return direction; } - bool hasTransition() const { - return transitionEnd; + void setDirection(Direction dir) { + direction = dir; } - - void moveTo(Map *map, Position newPos); - bool move(Map *map, Direction dir, uint64_t start, uint64_t end); - void finishTransition(Map *map); }; } |