Sky Zone Omega - PC Version
 All Classes Namespaces Files Functions Variables Macros
E_EntityManager.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 #include <unordered_map>
5 #include "Player/EP_Player.h"
6 #include "Enemies/EE_StyphBird.h"
8 #include "Enemies/EE_Archer.h"
9 #include "Pickups/EPU_Coin.h"
10 #include "Pickups/EPU_Health.h"
11 #include "Pickups/EPU_Flaming.h"
12 #include "Pickups/EPU_CoinAll.h"
13 #include "Pickups/EPU_KillAll.h"
14 #include "Pickups/EPU_Shield.h"
15 #include "Pickups/EPU_TimeSlow.h"
16 #include "Arrows/EA_PlayerArrow.h"
17 #include "Arrows/EA_FlamingArrow.h"
18 #include "Arrows/EA_ArcherArrow.h"
19 #include "../Core/C_Audio.h"
20 #include "../Core/C_Timer.h"
21 #include "../ParticleSystem/PS_ParticleEffect.h"
22 
28 {
29 public:
40  E_EntityManager(C_Vec2 dimensions, EP_Player* player, SDL_Renderer* renderer, C_Texture* fireSprite,
41  SDL_Colour minFireTint, SDL_Colour maxFireTint, float* universalSpeed);
42 
47 
52  void update(float dt);
53 
57  void draw();
58 
64  C_Texture* getTexture(std::string iD);
65 
71  C_Vec2 getEntityDimensions(std::string iD);
72 
77  std::vector<EE_StyphBird*> getStyphBirds();
78 
83  std::vector<EE_StormCloud*> getStormClouds();
84 
89  std::vector<EE_Archer*> getArchers();
90 
95  std::vector<EPU_Coin*> getCoins();
96 
101  std::vector<EPU_Health*> getHealthPickups();
102 
107  std::vector<EPU_Flaming*> getFlamingPickups();
108 
113  std::vector<EPU_KillAll*> getKillAllPickups();
114 
119  std::vector<EPU_CoinAll*> getCoinAllPickups();
120 
125  std::vector<EPU_Shield*> getShieldPickups();
126 
131  std::vector<EPU_TimeSlow*> getTimeSlowPickups();
132 
137  std::vector<EA_PlayerArrow*> getPlayerArrows();
138 
143  std::vector<EA_FlamingArrow*> getFlamingArrows();
144 
149  std::vector<EA_ArcherArrow*> getArcherArrows();
150 
154  void playCoinCollectSound();
155 
159  void playHealthCollectSound();
160 
164  void playShieldCollectSound();
165 
170 
174  void playFireCollectSound();
175 
180 
184  void playEnemyDeathSound();
185 
189  void playEnemyHitSound();
190 
195  void spawnStyphBird(C_Vec2 spawnPos);
196 
201  void spawnStormCloud(C_Vec2 spawnPos);
202 
207  void spawnArcher(C_Vec2 spawnPos);
208 
213  void spawnCoin(C_Vec2 spawnPos);
214 
219  void spawnHealth(C_Vec2 spawnPos);
220 
225  void spawnFlaming(C_Vec2 spawnPos);
226 
231  void spawnCoinAll(C_Vec2 spawnPos);
232 
237  void spawnKillAll(C_Vec2 spawnPos);
238 
243  void spawnShield(C_Vec2 spawnPos);
244 
249  void spawnTimeSlow(C_Vec2 spawnPos);
250 
251 private:
255  SDL_Renderer* renderer;
259  std::unordered_map<std::string, C_Texture*> textures;
261  std::unordered_map<std::string, C_Vec2> entityDimensions;
264 
265  //Enemies
266 
268  std::vector<EE_StyphBird*> styphBirds;
270  std::vector<EE_StormCloud*> stormClouds;
272  std::vector<EE_Archer*> archers;
273 
274  //Pickups
275 
277  std::vector<EPU_Coin*> coins;
279  std::vector<EPU_Health*> healthPickups;
281  std::vector<EPU_Flaming*> flamingPickups;
283  std::vector<EPU_KillAll*> killAllPickups;
285  std::vector<EPU_CoinAll*> coinAllPickups;
287  std::vector<EPU_Shield*> shieldPickups;
289  std::vector<EPU_TimeSlow*> timeSlowPickups;
290 
291  //Arrows
292 
294  std::vector<EA_PlayerArrow*> playerArrows;
296  std::vector<EA_FlamingArrow*> flamingArrows;
298  std::vector<EA_ArcherArrow*> archerArrows;
299 
300  //Particle Effects
301 
303  std::unordered_map<std::string, SDL_Colour> minColourTints;
305  std::unordered_map<std::string, SDL_Colour> maxColourTints;
307  std::vector<PS_ParticleEffect*> deathEffects;
308 
309  //Audio
310 
331 
332 
336  void removeDeadEntites();
337 
347  void createDeathEffects(C_Vec2 entityPos, C_Vec2 entityVelocity, C_Vec2 deadEntityDimensions,
348  bool coinSpawn, int maxCoins, std::string entityType);
349 
353  void removeCompletedEffects();
354 };
C_Audio * timeSlowCollectSound
The time slow collect sound effect.
Definition: E_EntityManager.h:326
std::vector< EA_PlayerArrow * > getPlayerArrows()
Gets the vector array of PlayerArrow pointers.
Definition: E_EntityManager.cpp:690
C_Vec2 screenDimensions
The screen dimensions.
Definition: E_EntityManager.h:253
void playHealthCollectSound()
Plays the health collect sound.
Definition: E_EntityManager.cpp:710
void spawnFlaming(C_Vec2 spawnPos)
Spawn a new Flaming pickup.
Definition: E_EntityManager.cpp:776
std::vector< EPU_Health * > getHealthPickups()
Gets the vector array of Health pointers.
Definition: E_EntityManager.cpp:660
void removeCompletedEffects()
A function that deletes all of the entities flagged as dead.
Definition: E_EntityManager.cpp:603
Handles audio using SDL_Mixer.
Definition: C_Audio.h:12
std::vector< EA_ArcherArrow * > archerArrows
The vector array of Archer Arrows.
Definition: E_EntityManager.h:298
void spawnArcher(C_Vec2 spawnPos)
Spawn a new Archer.
Definition: E_EntityManager.cpp:758
std::vector< EE_StormCloud * > stormClouds
The vector array of Storm Clouds.
Definition: E_EntityManager.h:270
std::vector< EPU_Flaming * > getFlamingPickups()
Gets the vector array of Flaming pointers.
Definition: E_EntityManager.cpp:665
void spawnShield(C_Vec2 spawnPos)
Spawn a new Shield pickup.
Definition: E_EntityManager.cpp:794
C_Audio * fireArrowShotSound
The fire arrow shot sound effect.
Definition: E_EntityManager.h:314
void removeDeadEntites()
A function that deletes all of the entities flagged as dead.
Definition: E_EntityManager.cpp:373
std::vector< EPU_Health * > healthPickups
The vector array of Health.
Definition: E_EntityManager.h:279
void spawnStormCloud(C_Vec2 spawnPos)
Spawn a new StormCloud.
Definition: E_EntityManager.cpp:752
std::vector< EA_FlamingArrow * > flamingArrows
The vector array of Flaming Arrows.
Definition: E_EntityManager.h:296
C_Audio * coinKillAllCollectSound
The coin all and the kill all collect sound effect.
Definition: E_EntityManager.h:322
C_Audio * coinCollectSound
The coin collect sound effect.
Definition: E_EntityManager.h:318
std::vector< EPU_Flaming * > flamingPickups
The vector array of Flaming power ups.
Definition: E_EntityManager.h:281
C_Audio * enemyHitSound
The enemy hit sound effect.
Definition: E_EntityManager.h:330
std::vector< EPU_TimeSlow * > getTimeSlowPickups()
Gets the vector array of TimeSlow pointers.
Definition: E_EntityManager.cpp:685
Contains the Vec2 structure with functions and overloaded operators.
Definition: C_Vec2.h:7
C_Audio * fireCollectSound
The fire collect sound effect.
Definition: E_EntityManager.h:324
C_Vec2 getEntityDimensions(std::string iD)
Gets the dimensions of the wanted entity.
Definition: E_EntityManager.cpp:635
std::vector< EA_ArcherArrow * > getArcherArrows()
Gets the vector array of ArcherArrow pointers.
Definition: E_EntityManager.cpp:700
std::vector< EPU_Shield * > shieldPickups
The vector array of shield.
Definition: E_EntityManager.h:287
E_EntityManager(C_Vec2 dimensions, EP_Player *player, SDL_Renderer *renderer, C_Texture *fireSprite, SDL_Colour minFireTint, SDL_Colour maxFireTint, float *universalSpeed)
Constructs the Entity Manager.
Definition: E_EntityManager.cpp:3
void playEnemyHitSound()
Plays the enemy hit sound.
Definition: E_EntityManager.cpp:740
void spawnStyphBird(C_Vec2 spawnPos)
Spawn a new StyphBird.
Definition: E_EntityManager.cpp:745
void spawnKillAll(C_Vec2 spawnPos)
Spawn a new KillAll pickup.
Definition: E_EntityManager.cpp:788
void spawnCoinAll(C_Vec2 spawnPos)
Spawn a new CoinAll pickup.
Definition: E_EntityManager.cpp:782
std::vector< EE_Archer * > getArchers()
Gets the vector array of Archer pointers.
Definition: E_EntityManager.cpp:650
void spawnCoin(C_Vec2 spawnPos)
Spawn a new Coin.
Definition: E_EntityManager.cpp:764
std::vector< EA_PlayerArrow * > playerArrows
The vector array of Player Arrows.
Definition: E_EntityManager.h:294
void playShieldCollectSound()
Plays the shield collect sound.
Definition: E_EntityManager.cpp:715
A class that manages all of the entities in the game with the exception of the player.
Definition: E_EntityManager.h:27
Contains the data and functions for the player.
Definition: EP_Player.h:16
void playCoinKillAllCollectSound()
Plays the coin and kill all collect sound.
Definition: E_EntityManager.cpp:720
EP_Player * player
A pointer to the Player.
Definition: E_EntityManager.h:257
SDL_Renderer * renderer
A pointer to the renderer.
Definition: E_EntityManager.h:255
std::vector< EE_StyphBird * > styphBirds
The vector array of StyphBirds.
Definition: E_EntityManager.h:268
std::vector< EPU_TimeSlow * > timeSlowPickups
The vector array of TimeSlow power ups.
Definition: E_EntityManager.h:289
void spawnHealth(C_Vec2 spawnPos)
Spawn a new Health pickup.
Definition: E_EntityManager.cpp:770
void playFireCollectSound()
Plays the fire collect sound.
Definition: E_EntityManager.cpp:725
void spawnTimeSlow(C_Vec2 spawnPos)
Spawn a new TimeSlow pickup.
Definition: E_EntityManager.cpp:800
std::vector< EE_Archer * > archers
The vector array of Archers.
Definition: E_EntityManager.h:272
~E_EntityManager()
Destructs the Entity Manager.
Definition: E_EntityManager.cpp:64
void playCoinCollectSound()
Plays the coin collect sound.
Definition: E_EntityManager.cpp:705
C_Audio * arrowShotSound
The arrow shot sound effect.
Definition: E_EntityManager.h:312
void playEnemyDeathSound()
Plays the enemy death sound.
Definition: E_EntityManager.cpp:735
std::unordered_map< std::string, C_Vec2 > entityDimensions
An unordered map of the entity dimensions.
Definition: E_EntityManager.h:261
std::vector< EPU_KillAll * > killAllPickups
The vector array of killAll power ups.
Definition: E_EntityManager.h:283
std::vector< PS_ParticleEffect * > deathEffects
The vector array of particle effects for use with entity death.
Definition: E_EntityManager.h:307
C_Audio * healthCollectSound
The health collect sound effect.
Definition: E_EntityManager.h:316
std::vector< EE_StyphBird * > getStyphBirds()
Gets the vector array of StyphBird pointers.
Definition: E_EntityManager.cpp:640
float * universalSpeed
A pointer for the universal speed of the game.
Definition: E_EntityManager.h:263
std::vector< EPU_KillAll * > getKillAllPickups()
Gets the vector array of KillAll pointers.
Definition: E_EntityManager.cpp:670
std::unordered_map< std::string, SDL_Colour > maxColourTints
An unordered map of max tint colours for use with the particle effects.
Definition: E_EntityManager.h:305
std::vector< EPU_Coin * > coins
The vector array of Coins.
Definition: E_EntityManager.h:277
void update(float dt)
A function to update the Entities.
Definition: E_EntityManager.cpp:163
C_Audio * shieldCollectSound
The shield collect sound effect.
Definition: E_EntityManager.h:320
std::vector< EPU_Shield * > getShieldPickups()
Gets the vector array of Shield pointers.
Definition: E_EntityManager.cpp:680
std::vector< EE_StormCloud * > getStormClouds()
Gets the vector array of StormCloud pointers.
Definition: E_EntityManager.cpp:645
C_Texture * getTexture(std::string iD)
Gets the pointer to the wanted texture.
Definition: E_EntityManager.cpp:630
std::unordered_map< std::string, SDL_Colour > minColourTints
An unordered map of min tint colours for use with the particle effects.
Definition: E_EntityManager.h:303
std::unordered_map< std::string, C_Texture * > textures
An unordered map of the sprite textures.
Definition: E_EntityManager.h:259
std::vector< EPU_Coin * > getCoins()
Gets the vector array of Coin pointers.
Definition: E_EntityManager.cpp:655
Creates a Texture for use with a renderer.
Definition: C_Texture.h:13
std::vector< EPU_CoinAll * > getCoinAllPickups()
Gets the vector array of CoinAll pointers.
Definition: E_EntityManager.cpp:675
void playTimeSlowCollectSound()
Plays the time slow collect sound.
Definition: E_EntityManager.cpp:730
std::vector< EA_FlamingArrow * > getFlamingArrows()
Gets the vector array of FlamingArrow pointers.
Definition: E_EntityManager.cpp:695
void draw()
A function to draw the Entities to the screen.
Definition: E_EntityManager.cpp:290
void createDeathEffects(C_Vec2 entityPos, C_Vec2 entityVelocity, C_Vec2 deadEntityDimensions, bool coinSpawn, int maxCoins, std::string entityType)
A function that creates the particle effects for if the entities are killed.
Definition: E_EntityManager.cpp:570
std::vector< EPU_CoinAll * > coinAllPickups
The vector array of coinAll power ups.
Definition: E_EntityManager.h:285
C_Audio * enemyDeathSound
The enemy death sound effect.
Definition: E_EntityManager.h:328