X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2FRandomWalk.hpp;h=8a0a19da51aaa898499d5cdba4202075bed5797f;hb=9da6ac5e93d79e79658a95d5f6efe42146873583;hp=0a61974fb2281c03b65ed4e9f6c363782bf44cad;hpb=745729c1935276e6f49d108a0a465214aa93c3cb;p=blank.git diff --git a/src/ai/RandomWalk.hpp b/src/ai/RandomWalk.hpp index 0a61974..8a0a19d 100644 --- a/src/ai/RandomWalk.hpp +++ b/src/ai/RandomWalk.hpp @@ -1,25 +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 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(); - void Update(int dt) noexcept; + void Update(int dt) override; private: - Entity &entity; + void Change() noexcept; + +private: + 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; };