From b3b30521e50f1ed0046091b316b19daec646b4ac Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Wed, 13 Dec 2017 16:27:34 +0100 Subject: Basic alien AI. --- src/game/game.hpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/game/game.hpp') diff --git a/src/game/game.hpp b/src/game/game.hpp index f45aecf..f141e85 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -45,7 +45,14 @@ namespace game { world::cflags_t cflags; size_t selected = 0; - unit_t(); + typedef enum { + UNIT_HUMAN, + UNIT_ALIEN + } type_t; + + type_t type; + + unit_t(type_t type_); struct { bool moving = false; @@ -62,23 +69,39 @@ namespace game { const wchar_t *say_text; double say_time = -INFINITY; + bool awake = false; + double wake_time = -INFINITY; + void render_to(render::state_t *render); void say(const wchar_t *wstr, double now); void place(world::world_t *world_, v2f_t x_); - bool keep_moving(double now, double dt); + bool keep_moving(double now, double dt, double speed); bool start_moving(v2f_t dst_, double now); + + virtual void wake(double now, unit_t *by_whom) = 0; + virtual void sleep(double now) = 0; + virtual void think(double now, double dt) = 0; }; class human_t : public unit_t { public: human_t(); void render_to(render::state_t *render); - bool keep_moving(double now, double dt); + + void wake(double now, unit_t *by_whom); + void sleep(double now); + void think(double now, double dt); }; class alien_t : public unit_t { + unit_t *target; + public: alien_t(); void render_to(render::state_t *render); + + void wake(double now, unit_t *by_whom); + void sleep(double now); + void think(double now, double dt); }; }; -- cgit