blob: 8a51c3f5aef3f2ed1d466ae30be018d196db794d (
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
31
32
|
#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_shared<ExampleGenerator>(position, bullets);
auto behaviour = std::make_shared<FallingAndOscillating>(position, generator);
generator->m_position = position;
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;
}
|