X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2FRandomWalk.hpp;h=339e77d3566a8fa9fe33b4c04ea213076ebf4aca;hb=33b37e7242e4cbfa76e4a0d6e5bb54223b541162;hp=41319dd53ae3d6d696c053791fb59de5d1856d9f;hpb=aefc5482b27e3d259b6c9f3f1e4cdd9ef2e6a8d2;p=blank.git diff --git a/src/ai/RandomWalk.hpp b/src/ai/RandomWalk.hpp index 41319dd..339e77d 100644 --- a/src/ai/RandomWalk.hpp +++ b/src/ai/RandomWalk.hpp @@ -1,28 +1,37 @@ -#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 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; - int time_left; + int switch_time; + float lerp_max; + float lerp_time; };