1 #ifndef BLOBS_CREATURE_CREATURE_HPP_
2 #define BLOBS_CREATURE_CREATURE_HPP_
7 #include "Situation.hpp"
8 #include "Steering.hpp"
9 #include "../graphics/SimpleVAO.hpp"
10 #include "../math/glm.hpp"
34 explicit Creature(world::Simulation &);
37 Creature(const Creature &) = delete;
38 Creature &operator =(const Creature &) = delete;
40 Creature(Creature &&) = delete;
41 Creature &operator =(Creature &&) = delete;
44 world::Simulation &GetSimulation() noexcept { return sim; }
45 const world::Simulation &GetSimulation() const noexcept { return sim; }
47 void Name(const std::string &n) noexcept { name = n; }
48 const std::string &Name() const noexcept { return name; }
50 Genome &GetGenome() noexcept { return genome; }
51 const Genome &GetGenome() const noexcept { return genome; }
53 void Mass(double m) noexcept { mass = m; }
54 double Mass() const noexcept { return mass; }
56 void Size(double s) noexcept { size = s; }
57 double Size() const noexcept { return size; }
59 void Health(double h) noexcept { health = h; }
60 double Health() const noexcept { return health; }
61 void Hurt(double d) noexcept;
63 void AddNeed(std::unique_ptr<Need> &&n) { needs.emplace_back(std::move(n)); }
64 const std::vector<std::unique_ptr<Need>> &Needs() const noexcept { return needs; }
66 void AddGoal(std::unique_ptr<Goal> &&);
67 const std::vector<std::unique_ptr<Goal>> &Goals() const noexcept { return goals; }
71 Situation &GetSituation() noexcept { return situation; }
72 const Situation &GetSituation() const noexcept { return situation; }
74 Steering &GetSteering() noexcept { return steering; }
75 const Steering &GetSteering() const noexcept { return steering; }
77 void Velocity(const glm::dvec3 &v) noexcept { vel = v; }
78 const glm::dvec3 &Velocity() const noexcept { return vel; }
79 bool Moving() const noexcept { return glm::length2(vel) < 0.000001; }
81 glm::dmat4 LocalTransform() noexcept;
84 void Draw(app::Assets &, graphics::Viewport &);
87 world::Simulation ∼
96 std::vector<std::unique_ptr<Need>> needs;
97 std::vector<std::unique_ptr<Goal>> goals;
109 graphics::SimpleVAO<Attributes, unsigned short> vao;
113 /// put creature on planet and configure it to (hopefully) survive
114 void Spawn(Creature &, world::Planet &, app::Assets &);