33 lines
523 B
C++
33 lines
523 B
C++
#pragma once
|
|
#include "fsm.hpp"
|
|
#include "map.hpp"
|
|
|
|
enum class EntityState {
|
|
START, HUNTING, DEAD
|
|
};
|
|
|
|
enum class EntityEvent {
|
|
GO, HIT
|
|
};
|
|
|
|
|
|
class Entity : public DeadSimpleFSM<EntityState, EntityEvent> {
|
|
public:
|
|
Point location;
|
|
int hp = 20;
|
|
int damage = 10;
|
|
|
|
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);
|
|
};
|