You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
538 B
35 lines
538 B
#pragma once
|
|
#include "fsm.hpp"
|
|
#include "map.hpp"
|
|
|
|
enum class EntityState {
|
|
START, HUNTING, DEAD
|
|
};
|
|
|
|
enum class EntityEvent {
|
|
GO, HIT
|
|
};
|
|
|
|
|
|
struct Entity : public DeadSimpleFSM<EntityState, EntityEvent> {
|
|
Point location{0,0};
|
|
int hp = 20;
|
|
int damage = 10;
|
|
|
|
Entity() {
|
|
}
|
|
|
|
Entity(Point loc) : location(loc) {
|
|
}
|
|
|
|
// disable copy
|
|
Entity(Entity &e) = delete;
|
|
|
|
void move(Point loc);
|
|
void event(EntityEvent ev);
|
|
|
|
// states
|
|
void START(EntityEvent ev);
|
|
void HUNTING(EntityEvent ev);
|
|
void DEAD(EntityEvent ev);
|
|
};
|
|
|