feat(enemy): els enemics poden disparar bales via tick d'IA
This commit is contained in:
@@ -57,6 +57,13 @@ void Enemy::init(EnemyType type, const Vec2* ship_pos) {
|
||||
ai_state_ = EnemyAiState{};
|
||||
ai_state_.tracking_strength = cfg.ai.movement.tracking_strength;
|
||||
|
||||
// Timers paral·lels a tick: random [0, interval) per evitar que tots els
|
||||
// enemics del mateix tipus disparin sincronitzats al spawn.
|
||||
ai_tick_timers_.resize(cfg.ai.tick.size());
|
||||
for (std::size_t i = 0; i < cfg.ai.tick.size(); ++i) {
|
||||
ai_tick_timers_[i] = randFloat01() * cfg.ai.tick[i].interval;
|
||||
}
|
||||
|
||||
shape_ = Graphics::ShapeLoader::load(cfg.shape.path);
|
||||
if (!shape_ || !shape_->isValid()) {
|
||||
std::cerr << "[Enemy] Error: no se ha podido cargar " << cfg.shape.path << '\n';
|
||||
|
||||
Reference in New Issue
Block a user