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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "EnemyFactory.h"
#include <memory>
#include <raylib.h>
#include "ConstantVelocity.h"
#include "Enemy.h"
#include "ExampleGenerator.h"
#include "FallingAndOscillating.h"
#include "WaveGenerator.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_shared<ExampleGenerator>(position, bullets);
auto behaviour = std::make_shared<FallingAndOscillating>(position, generator);
if (mirror) {
generator->m_color = Color{100, 0, 255, 255};
generator->m_direction *= -1;
behaviour->m_phase = 1.f;
}
Enemy enemy(position, generator, behaviour);
enemy.m_hold = hold;
return enemy;
}
Enemy
EnemyFactory::make_waver(
ConstantVelocityBullet::Vector& bullets,
const float x, const float y,
const float hold)
{
auto position = std::make_shared<Vector2>(Vector2{x, y});
auto generator = std::make_shared<WaveGenerator>(position, bullets);
auto behaviour = std::make_shared<Falling>(position, generator);
Enemy enemy(position, generator, behaviour);
enemy.m_hold = hold;
return enemy;
}
|