X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcreature%2FCreature.hpp;h=7c3d1ef0f924cad93614a7c8dba26a59d005fbf5;hb=2025d49798b93180237b6ce62d3ff5d6ee8ebc6e;hp=135cf9eb1d98d80d70a327f38a66e106d42af679;hpb=4ec93ba5186dca958be6e2a4dc2aaf3572a524cb;p=blobs.git diff --git a/src/creature/Creature.hpp b/src/creature/Creature.hpp index 135cf9e..7c3d1ef 100644 --- a/src/creature/Creature.hpp +++ b/src/creature/Creature.hpp @@ -2,9 +2,11 @@ #define BLOBS_CREATURE_CREATURE_HPP_ #include "Need.hpp" +#include "Situation.hpp" #include "../graphics/glm.hpp" #include "../graphics/SimpleVAO.hpp" +#include #include #include @@ -35,37 +37,32 @@ public: Creature &operator =(Creature &&) = delete; public: - void SetBody(world::Body &b) noexcept { body = &b; } - world::Body &GetBody() noexcept { return *body; } - const world::Body &GetBody() const noexcept { return *body; } - - void Surface(int s) noexcept { surface = s; } - void Position(const glm::dvec3 &p) noexcept { position = p; } - void Name(const std::string &n) noexcept { name = n; } const std::string &Name() const noexcept { return name; } void Health(double h) noexcept { health = h; } double Health() const noexcept { return health; } + void Hurt(double d) noexcept; - void AddNeed(const Need &n) { needs.push_back(n); } - const std::vector &Needs() const noexcept { return needs; } + void AddNeed(std::unique_ptr &&n) { needs.emplace_back(std::move(n)); } + const std::vector> &Needs() const noexcept { return needs; } void Tick(double dt); + Situation &GetSituation() noexcept { return situation; } + const Situation &GetSituation() const noexcept { return situation; } + glm::dmat4 LocalTransform() noexcept; void BuildVAO(); void Draw(app::Assets &, graphics::Viewport &); private: - world::Body *body; - int surface; - glm::dvec3 position; - std::string name; double health; - std::vector needs; + std::vector> needs; + + Situation situation; struct Attributes { glm::vec3 position;