]> git.localhorst.tv Git - blank.git/blobdiff - src/ai/RandomWalk.hpp
merge common parts of pre- and unload states
[blank.git] / src / ai / RandomWalk.hpp
index 41319dd53ae3d6d696c053791fb59de5d1856d9f..8a0a19da51aaa898499d5cdba4202075bed5797f 100644 (file)
@@ -1,28 +1,40 @@
-#ifndef BLANK_APP_RANDOMWALK_HPP_
-#define BLANK_APP_RANDOMWALK_HPP_
+#ifndef BLANK_AI_RANDOMWALK_HPP_
+#define BLANK_AI_RANDOMWALK_HPP_
+
+#include "Controller.hpp"
+
+#include "../rand/GaloisLFSR.hpp"
 
 #include <glm/glm.hpp>
 
 
 namespace blank {
 
-class Entity;
-
 /// Randomly start or stop moving in axis directions every now and then.
-class RandomWalk {
+class RandomWalk
+: public Controller {
 
 public:
-       explicit RandomWalk(Entity &) noexcept;
+       RandomWalk(Entity &, std::uint64_t seed) noexcept;
+       ~RandomWalk();
 
-       Entity &Controlled() noexcept { return entity; }
-       const Entity &Controlled() const noexcept { return entity; }
+       void Update(int dt) override;
 
-       void Update(int dt) noexcept;
+private:
+       void Change() noexcept;
 
 private:
-       Entity &entity;
+       GaloisLFSR random;
+
+       glm::vec3 start_vel;
+       glm::vec3 target_vel;
+
+       glm::vec3 start_rot;
+       glm::vec3 target_rot;
 
-       int time_left;
+       int switch_time;
+       float lerp_max;
+       float lerp_time;
 
 };