-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulation.h
139 lines (103 loc) · 3.92 KB
/
population.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef POPULATION_H_INCLUDED
#define POPULATION_H_INCLUDED
#include <list>
#include <string>
#include <SFML/Graphics.hpp>
#include <tr1/memory>
#include "enemies/enemy.h"
#include "tirs/projectile.h"
#include "tirs/projectile_manager.h"
#include "drop_manager.h"
#include "enemies/boss.h"
#include "player.h"
#include "image_manager.h"
#include "enemies/spawn.h"
#include "tirs/score_manager.h"
#include "Anim.hpp"
#include "const.h"
#include "timer.h"
#include "enemies/boss/lilith.h"
#include "enemies/boss/octopus.h"
#include "enemies/boss/megaspawner.h"
#include "enemies/adds.h"
#include "enemies/ship.h"
#include "enemies/flying_saucer.h"
//Permet de stocker et gérer les ennemis
class Population
{
public:
//Liste des ennemis
std::list<std::tr1::shared_ptr<Enemy> >* getPopulation();
std::list<std::tr1::shared_ptr<Boss> >* getBossPopulation();
//Vérifie si des ennemis sont en vie
bool haveEnnemyInProgress();
//Permet de dessiner les ennemis et les projectiles
void drawPopulation();
//Vérifie l'état des ennemis et des projectiles
void checkPopulation();
//Met le jeu en pause
void stop();
//Sort le jeu de sa pause
void unStop();
//Créateurs d'ennemis
void createShip(sf::Vector2f position, const std::string &filepath);
void createShip2(const std::string &filepath);
void createFlyingSaucer(sf::Vector2f position, const std::string &filepath);
void createFlyingSaucer2(sf::Vector2f position, const std::string &move);
void createFlyingSaucer3(sf::Vector2f position, const std::string &move);
void createSpawner(sf::Vector2f position, const std::string &filepath);
void createAdd(int life, int scoreHit, int scoreExplosion, int xSpeed, int ySpeed, const std::string &filepath, sf::Vector2f position, sf::Vector2f absolutePosition, const char* const type, const char* const moveMethod, int moveValue,
const int coefSpeed, const int firerate,bool spawner, std::tr1::shared_ptr<Player> externPlayer, std::tr1::shared_ptr<Player> externPlayer2);
//Fait exploser un ennemi
void explode(std::tr1::shared_ptr<Enemy> enemy);
//Fait evoluer l'animaton de l'explosion
void manageExplosion();
//Gère les fonctions de mise à jour
void manage();
//Création d'un boss
void createLilith1();
void createLilith2();
void createOctopus();
void createMegaspawner();
//Vérifient qu'il y a des spawn en jeu
bool haveSpawnInProgress();
bool haveBossInProgress();
void spawn(std::tr1::shared_ptr<Enemy> enemy);
static void kill();
static Population* getInstance();
void setPlayer(std::tr1::shared_ptr<Player> externPlayer, std::tr1::shared_ptr<Player> externPlayer2);
void freeze();
void unfreeze();
bool isFreezed();
void reset();
int getKilledEnemies();
unsigned short getCombo();
void killThemAll();
protected:
//Liste des ennemis
std::list<std::tr1::shared_ptr<Enemy> > m_enemies;
//Liste des ennemis morts
std::list<std::tr1::shared_ptr<Enemy> > m_deadEnemies;
std::tr1::shared_ptr<Player> player;
std::tr1::shared_ptr<Player> player2;
std::tr1::shared_ptr<Boss> currentBoss;
bool bossSpawned;
private:
sf::SoundBuffer boomBuffer;
sf::Sound boomSound;
sf::SoundBuffer boom2Buffer;
sf::Sound boom2Sound;
//Constructeur privé pour singleton
Population();
Timer timerCombo;
//Destructeur
virtual ~Population();
static Population* _singleton;
bool freezed;
short m_coefSpeed;
int killedEnemies;
unsigned short combo, maxCombo;
short const killRate;
Timer timerFreeze;
};
#endif // POPULATION_H_INCLUDED