Create the systems.cpp for the boss fight mini game.
This commit is contained in:
parent
27b71d4ba3
commit
06f6098281
7 changed files with 67 additions and 38 deletions
29
boss/system.cpp
Normal file
29
boss/system.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "boss/system.hpp"
|
||||
#include <fmt/core.h>
|
||||
#include "components.hpp"
|
||||
#include "game_level.hpp"
|
||||
|
||||
namespace boss {
|
||||
using namespace components;
|
||||
|
||||
void System::load_config() {
|
||||
fmt::println("load it");
|
||||
}
|
||||
|
||||
shared_ptr<boss::UI> System::create_bossfight() {
|
||||
auto& level = GameDB::current_level();
|
||||
auto prev_world = GameDB::current_world();
|
||||
dbc::check(prev_world != nullptr, "Starter world for boss fights can't be null.");
|
||||
auto world = GameDB::clone_load_world(prev_world);
|
||||
auto& config = prev_world->get_the<GameConfig>();
|
||||
|
||||
auto boss_names = config.bosses.keys();
|
||||
auto& level_name = boss_names[level.index % boss_names.size()];
|
||||
auto& boss_data = config.bosses[level_name];
|
||||
|
||||
auto boss_id = world->entity();
|
||||
components::configure_entity(*world, boss_id, boss_data["components"]);
|
||||
|
||||
return make_shared<boss::UI>(world, boss_id);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue