]> git.localhorst.tv Git - blobs.git/blob - src/creature/LocateResourceGoal.hpp
moar intelligent search
[blobs.git] / src / creature / LocateResourceGoal.hpp
1 #ifndef BLOBS_CREATURE_LOCATERESOURCEGOAL_HPP_
2 #define BLOBS_CREATURE_LOCATERESOURCEGOAL_HPP_
3
4 #include "Composition.hpp"
5 #include "../math/glm.hpp"
6
7
8 namespace blobs {
9 namespace creature {
10
11 class LocateResourceGoal
12 : public Goal {
13
14 public:
15         LocateResourceGoal(Creature &);
16         ~LocateResourceGoal() noexcept override;
17
18 public:
19         void SetMinimum(double m) noexcept { minimum = m; }
20         void Accept(int resource, double attractiveness);
21
22         std::string Describe() const override;
23         void Enable() override;
24         void Tick(double dt) override;
25         void Action() override;
26
27 private:
28         void LocateResource();
29         void SearchVicinity();
30         void Remember();
31         void RandomWalk();
32         bool OnTarget() const noexcept;
33
34 private:
35         Composition accept;
36         bool found;
37         glm::dvec3 target_pos;
38         bool searching;
39         double reevaluate;
40         double minimum;
41
42 };
43
44 }
45 }
46
47 #endif