#include #include #include #include #include namespace kurator { namespace battles { Battle::Battle(Scenario scenario) { std::random_device dev; std::uniform_real_distribution<> pos{-2.5, 2.5}; for (const auto& ship : scenario.ships) { const auto entity = registry.create(); registry.emplace(entity, ship.type); registry.emplace(entity, ship.team); registry.emplace(entity, Point{pos(dev), pos(dev)}, Point{0.0, 0.0}); } } void Battle::update(const float dt) { auto view = registry.view(); for (auto&& [entity, transform, team] : view.each()) transform.position.x += 0.1 * dt * (team.id * 2 - 1); } } // namespace battles } // namespace kurator