Files
orni-attack/source/game/entities/enemy_registry.hpp
T
JailDesigner bc41169176 feat(enemy): afegir tipus STAR (estrella de 5 puntes) i 3 nous shapes
- Nou enemic STAR amb shape star_5.shp, escala 0.7 i color groc pur.
  Reusa el comportament zigzag del Pentagon i carrega via EnemyRegistry.
- DistribucioEnemics estesa amb camp 'star' opcional (default 0) per
  mantenir compat amb stages antics.
- Stage 1 reconfigurat a 25/25/25/25 per mostrar els 4 tipus.
- Afegits també shapes bullet_long.shp i bullet_double.shp (encara no
  utilitzats; preparats per futures variants de bala).
2026-05-25 12:36:26 +02:00

32 lines
1.0 KiB
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 EnemyConfig star_config;
static bool loaded;
};