31 lines
1021 B
C++
31 lines
1021 B
C++
// enemy_registry.hpp - Registre estàtic de configuracions d'enemics per tipus
|
|
// © 2026 JailDesigner
|
|
//
|
|
// Carrega els 3 fitxers YAML (pentagon, square, pinwheel) un cop al startup
|
|
// i exposa el lookup per EnemyType. Pensat per a ser invocat des de
|
|
// GameScene; si la càrrega falla, el caller decideix avortar.
|
|
|
|
#pragma once
|
|
|
|
#include "game/entities/enemy.hpp"
|
|
#include "game/entities/enemy_config.hpp"
|
|
|
|
class EnemyRegistry {
|
|
public:
|
|
EnemyRegistry() = delete; // tot estàtic
|
|
|
|
// Carrega els 3 descriptors. Retorna true si tots tres s'han carregat
|
|
// i parsejat correctament. Cridar abans del primer get().
|
|
static auto loadAll() -> bool;
|
|
|
|
// Lookup. Cal haver cridat loadAll() abans. Si el tipus no s'ha carregat
|
|
// (loadAll fallida o no cridada), avorta amb log fatal.
|
|
static auto get(EnemyType type) -> const EnemyConfig&;
|
|
|
|
private:
|
|
static EnemyConfig pentagon_config;
|
|
static EnemyConfig square_config;
|
|
static EnemyConfig pinwheel_config;
|
|
static bool loaded;
|
|
};
|