1 #ifndef BLOBS_CREATURE_CREATURE_HPP_
2 #define BLOBS_CREATURE_CREATURE_HPP_
6 #include "Situation.hpp"
7 #include "Steering.hpp"
8 #include "../graphics/glm.hpp"
9 #include "../graphics/SimpleVAO.hpp"
33 explicit Creature(world::Simulation &);
36 Creature(const Creature &) = delete;
37 Creature &operator =(const Creature &) = delete;
39 Creature(Creature &&) = delete;
40 Creature &operator =(Creature &&) = delete;
43 world::Simulation &GetSimulation() noexcept { return sim; }
44 const world::Simulation &GetSimulation() const noexcept { return sim; }
46 void Name(const std::string &n) noexcept { name = n; }
47 const std::string &Name() const noexcept { return name; }
49 void Size(double s) noexcept { size = s; }
50 double Size() const noexcept { return size; }
52 void Health(double h) noexcept { health = h; }
53 double Health() const noexcept { return health; }
54 void Hurt(double d) noexcept;
56 void AddNeed(std::unique_ptr<Need> &&n) { needs.emplace_back(std::move(n)); }
57 const std::vector<std::unique_ptr<Need>> &Needs() const noexcept { return needs; }
59 void AddGoal(std::unique_ptr<Goal> &&);
60 const std::vector<std::unique_ptr<Goal>> &Goals() const noexcept { return goals; }
64 Situation &GetSituation() noexcept { return situation; }
65 const Situation &GetSituation() const noexcept { return situation; }
67 Steering &GetSteering() noexcept { return steering; }
68 const Steering &GetSteering() const noexcept { return steering; }
70 void Velocity(const glm::dvec3 &v) noexcept { vel = v; }
71 const glm::dvec3 &Velocity() const noexcept { return vel; }
72 bool Moving() const noexcept { return !allzero(vel); }
74 glm::dmat4 LocalTransform() noexcept;
77 void Draw(app::Assets &, graphics::Viewport &);
80 world::Simulation ∼
85 std::vector<std::unique_ptr<Need>> needs;
86 std::vector<std::unique_ptr<Goal>> goals;
98 graphics::SimpleVAO<Attributes, unsigned short> vao;
102 /// put creature on planet and configure it to (hopefully) survive
103 void Spawn(Creature &, world::Planet &, app::Assets &);