]> git.localhorst.tv Git - blank.git/blob - src/ai/RandomWalk.hpp
8a0a19da51aaa898499d5cdba4202075bed5797f
[blank.git] / src / ai / RandomWalk.hpp
1 #ifndef BLANK_AI_RANDOMWALK_HPP_
2 #define BLANK_AI_RANDOMWALK_HPP_
3
4 #include "Controller.hpp"
5
6 #include "../rand/GaloisLFSR.hpp"
7
8 #include <glm/glm.hpp>
9
10
11 namespace blank {
12
13 /// Randomly start or stop moving in axis directions every now and then.
14 class RandomWalk
15 : public Controller {
16
17 public:
18         RandomWalk(Entity &, std::uint64_t seed) noexcept;
19         ~RandomWalk();
20
21         void Update(int dt) override;
22
23 private:
24         void Change() noexcept;
25
26 private:
27         GaloisLFSR random;
28
29         glm::vec3 start_vel;
30         glm::vec3 target_vel;
31
32         glm::vec3 start_rot;
33         glm::vec3 target_rot;
34
35         int switch_time;
36         float lerp_max;
37         float lerp_time;
38
39 };
40
41 }
42
43 #endif