-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevel01.cpp
More file actions
39 lines (31 loc) · 801 Bytes
/
Level01.cpp
File metadata and controls
39 lines (31 loc) · 801 Bytes
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
#include "Level01.h"
#include "Logger.h"
#include <algorithm>
#include "Classic.h"
#include "CollisionDetector.h"
Level01::Level01()
{
Logger::get() << "Initializing the level01 slide...\n";
this->brain = std::make_unique<Classic>();
}
SlideType Level01::getNextSlide()
{
const auto& [player, bullets, enemies] = GameComponents::get().getAllComponents();
auto allDead = std::all_of(enemies.cbegin(), enemies.cend(), [](const Enemy& enemy)
{
return !enemy.visible;
});
if (allDead)
{
this->stop();
return SlideType::betweenLevels;
}
return SlideType::level01;
}
void Level01::reset()
{
Timer::accumulatedTime = 0;
Level::reset();
auto& score = GameComponents::get().getScore();
score.setScore(0);
}