blob: b57322859c2a1c5594f32c89aff0dc4e4165efcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "EnemyFactory.h"
#include <memory>
#include <raylib.h>
#include "ConstantVelocity.h"
#include "Enemy.h"
#include "ExampleGenerator.h"
#include "FallingAndOscillating.h"
Enemy
EnemyFactory::make_example(
ConstantVelocityBullet::Vector& bullets,
const float x, const float y,
const float hold,
const bool mirror)
{
auto position = std::make_shared<Vector2>(Vector2{x, y});
auto generator = std::make_unique<ExampleGenerator>(bullets);
auto behaviour = std::make_unique<FallingAndOscillating>();
if (mirror) {
generator->m_direction *= -1;
behaviour->set_phase(1.f);
}
Enemy enemy(position, std::move(generator), std::move(behaviour));
enemy.m_hold = hold;
return enemy;
}
|