blob: e410f078bd2072f3eae2c5511ccddb94c8a21b0c (
plain)
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
|
#include <kurator/battles/Battle.h>
#include <random>
#include <kurator/battles/components.h>
#include <kurator/battles/Scenario.h>
#include <kurator/universe/ShipType.h>
namespace kurator
{
namespace battles
{
Battle::Battle(Scenario scenario)
{
std::random_device dev;
std::uniform_real_distribution<> pos{-5.0, 5.0};
for (const auto& ship : scenario.ships) {
const auto entity = registry.create();
registry.emplace<universe::ShipType>(entity, ship.type);
registry.emplace<Team>(entity, ship.team);
registry.emplace<Transform>(entity, Point{pos(dev), pos(dev)}, Point{0.0, 0.0});
}
}
} // namespace battles
} // namespace kurator
|