summaryrefslogtreecommitdiff
path: root/src/game/game.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-13 16:27:34 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-13 16:30:24 +0100
commitb3b30521e50f1ed0046091b316b19daec646b4ac (patch)
tree94da0045602da71c5c76b692f4ea4e8c510ca4b7 /src/game/game.hpp
parent15f4780dd94a06bec5616155c05810c731d2e4af (diff)
Basic alien AI.
Diffstat (limited to 'src/game/game.hpp')
-rw-r--r--src/game/game.hpp29
1 files changed, 26 insertions, 3 deletions
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);
};
};