-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnemySystem.cpp
51 lines (35 loc) · 1.06 KB
/
EnemySystem.cpp
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
48
49
50
51
#include "stdafx.h"
#include "EnemySystem.h"
//Constructors and Destructor:
EnemySystem::EnemySystem(std::vector<Enemy*>& active_enemies, std::map<const int, sf::Texture>& textures)
: activeEnemies(active_enemies), textures(textures)
{
}
EnemySystem::~EnemySystem()
{
}
void EnemySystem::createEnemy(const int& type, const float& x, const float& y, EnemySpawnerTile& enemy_spawner_tile)
{
switch (type)
{
case EnemyTypes::Type::Rat:
this->activeEnemies.push_back(new Rat(x, y, textures[Textures::Enemies::Rats::Rat::Idle_Down], enemy_spawner_tile));
enemy_spawner_tile.increaseEnemyCounter();
break;
default:
std::cout << "ERROR::EnemySystem::createEnemy::Enemy type doesn't exist: " << type << std::endl;
break;
}
}
void EnemySystem::removeEnemy(const int index)
{
this->activeEnemies[index]->getEnemySpawnerTile().decreaseEnemyCounter();
delete this->activeEnemies[index];
this->activeEnemies.erase(this->activeEnemies.begin() + index);
}
void EnemySystem::update(const float& dt)
{
}
void EnemySystem::render(sf::RenderTarget* target)
{
}