-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.hpp
52 lines (39 loc) · 1.39 KB
/
model.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef MODEL_HPP
#define MODEL_HPP
#include <cstdint>
#include <ctime>
#include "smv/imodel.hpp"
#include "snake.hpp"
#include "huntermodel.hpp"
#include "foodmodel.hpp"
enum class Signal : uint8_t
{
none, start, normal, survival, pause, end,
};
namespace game_model_settings {
constexpr uint8_t NORMAL_SNAKES_COUNT = 0;
constexpr uint8_t NORMAL_MOUSE_COUNT = 5;
constexpr uint8_t SURVIVAL_SNAKES_MIN_COUNT = 3;
constexpr uint8_t SURVIVAL_SNAKES_MAX_COUNT = 7;
constexpr uint8_t SURVIVAL_MOUSES_MIN_COUNT = 5;
constexpr uint8_t SURVIVAL_MOUSES_MAX_COUNT = 10;
}
class GameModel : public stf::smv::BaseModel
{
public:
GameModel(const stf::Vec2d& mapSize, uint8_t snakes = 0u, uint8_t mouses = 5u);
~GameModel() override;
stf::smv::ModelBaseState update(const float dt) override;
stf::smv::ModelBaseState keyEventsHandler(const int key) override;
void reset(uint8_t snakes = 0u, uint8_t mouses = 5u);
void killHunterHandler(HunterModel *hunterModel);
inline const FoodModel& foodModel() const { return m_foodModel;}
inline const stf::Vec2d& mapSize() const { return m_mapSize;}
inline const std::vector<HunterModel *>& hunterModels() const { return m_hunterModels; }
private:
std::vector<HunterModel *> m_hunterModels;
FoodModel m_foodModel;
stf::Vec2d m_mapSize = {0,0};
bool m_aiIsEnable = false;
};
#endif // MODEL_HPP