Files
coffee_crisis_arcade_edition/source/balloon_formations.h

71 lines
2.6 KiB
C++

#pragma once
#include "balloon.h" // Para BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE
#include <vector>
constexpr int NUMBER_OF_BALLOON_FORMATIONS = 100;
constexpr int MAX_NUMBER_OF_BALLOONS_IN_A_FORMATION = 50;
constexpr int NUMBER_OF_SETS_PER_POOL = 10;
constexpr int NUMBER_OF_STAGES = 10;
struct BalloonFormationParams
{
int x = 0; // Posición en el eje X donde crear el globo
int y = 0; // Posición en el eje Y donde crear el globo
float vel_x = 0.0f; // Velocidad inicial en el eje X
BalloonType type = BalloonType::BALLOON; // Tipo de globo
BalloonSize size = BalloonSize::SIZE1; // Tamaño de globo
int creation_counter = 0; // Temporizador para la creación del globo
// Constructor por defecto
BalloonFormationParams() = default;
// Constructor con parámetros
BalloonFormationParams(int x_val, int y_val, float vel_x_val, BalloonType type_val, BalloonSize size_val, int creation_counter_val)
: x(x_val), y(y_val), vel_x(vel_x_val), type(type_val), size(size_val), creation_counter(creation_counter_val) {}
};
struct BalloonFormationUnit
{
int number_of_balloons; // Cantidad de globos que forman la formación
std::vector<BalloonFormationParams> init; // Vector con todas las inicializaciones de los globos de la formación
// Constructor
BalloonFormationUnit(int num_balloons, const std::vector<BalloonFormationParams> &init_params)
: number_of_balloons(num_balloons), init(init_params) {}
// Default constructor
BalloonFormationUnit() : number_of_balloons(0), init() {}
};
using BalloonFormationPool = std::vector<const BalloonFormationUnit *>;
class BalloonFormations
{
private:
std::vector<BalloonFormationUnit> balloon_formation_; // Vector con todas las formaciones enemigas
std::vector<BalloonFormationPool> balloon_formation_pool_; // Variable con los diferentes conjuntos de formaciones enemigas
// Inicializa las formaciones enemigas
void initBalloonFormations();
// Inicializa los conjuntos de formaciones
void initBalloonFormationPools();
public:
// Constructor
BalloonFormations()
{
initBalloonFormations();
initBalloonFormationPools();
}
// Destructor
~BalloonFormations() = default;
// Getters
const BalloonFormationPool &getPool(int pool) { return balloon_formation_pool_.at(pool); }
const BalloonFormationUnit &getSet(int pool, int set) { return *balloon_formation_pool_.at(pool).at(set); }
const BalloonFormationUnit &getSet(int set) const { return balloon_formation_.at(set); }
};