FYP  1.0.0
Final Year Project -- Alexander Meuer
Level Class Reference

Playable level of the game. More...

#include <Level.hpp>

Inheritance diagram for Level:
Inheritance graph
Collaboration diagram for Level:
Collaboration graph

Public Member Functions

 Level (XMLElement *root)
 
bool handleEvent (sf::Event &Event) override
 
void update (sf::Time const &elapsedTime) override
 
void draw (sf::RenderWindow &w) override
 
void cleanup () override
 

Private Member Functions

void drawToUnderlay (sf::Drawable const &drawable)
 Draws an object to the underlay texture.
 
void onPawnDeath (Pawn *pawn)
 
void autofireProjectile (shared_ptr< Projectile > const &projectile) const
 Used to handle unfired projectile that are given to the projectile manager. Fires the projectile at the nearest enemy pawn. More...
 
void setupAbilities ()
 Initializes abilities and their buttons.
 
void setupTowerButtons ()
 
void spawnMinion (shared_ptr< Minion > const &unit, bool setPath=true, bool addFlock=true, bool addCollision=true)
 
void processPauseMenuResult ()
 
void processFailDialogueResult ()
 
void processCompletionDialogueResult ()
 
bool updatePawns (sf::Time const &elapsedTime)
 
void updateTowers (sf::Time const &elapsedTime)
 Calls update and shoot on all towers.
 
void ensureMusicPlaying ()
 Plays the background music if it is not playing.
 
void cleanPawnFlock () const
 Removes expired weak_ptrs from the list.
 

Static Private Member Functions

static bool compareDepth (shared_ptr< Actor > const &A, shared_ptr< Actor > const &B)
 Compares the y position of two actors for the purpose of sorting the draw order.
 

Private Attributes

gui::DialogueBox mPauseDialogue
 
gui::DialogueBox mCompleteDialogue
 
gui::DialogueBox mFailDialogue
 
std::list< std::pair< gui::AbilityButton, shared_ptr< Ability > > > mAbilityList
 
std::map< TowerPlacer::TowerType, std::unique_ptr< gui::CostButton > > mTowerButtons
 
shared_ptr< PawnmHero
 
shared_ptr< std::list< shared_ptr< Pawn > > > mPawns
 
shared_ptr< collision::CollisionGroupmCollisionGroup
 
std::vector< shared_ptr< tower::Tower > > mTowers
 List of towers in the level.
 
sf::Sprite mBackground
 Visual backdrop of level.
 
Camera mCamera
 Camera that follows mHero.
 
Hud mHud
 
shared_ptr< Quadtree< unsigned char > > terrainTree
 Quadtree used to decide where towers can be placed.
 
shared_ptr< ProjectileManagermProjectileManager
 
std::unique_ptr< TowerPlacermTowerPlacer
 Tool for placing towers.
 
shared_ptr< PathmPath
 Path that Minions will follow.
 
shared_ptr< int > mMoney
 Amount of money at the player's disposal. Earned by killing Minions, spent on building towers.
 
shared_ptr< int > mLivesRemaining
 Number of enemies that can make it through the level alive before losing.
 
sf::FloatRect mBounds
 Bounds of the level. Pawns outside this are killed outright and mLivesRemaining is decremented every time it happens.
 
sf::RenderTexture mUnderlayTex
 RenderTexture used for persisting dead bodies and blood without clogging the update.
 
sf::Sprite mUnderlaySpr
 Sprite used to draw mUnderlayTex to the screen.
 
sf::Music mBgMusic
 Background music of the level.
 
const std::string mNextLevel
 Level to unlock if the player completes this level.
 
shared_ptr< std::list< std::weak_ptr< Pawn > > > mFlock
 Flock of enemy minions.
 
WaveController mWaveController
 Controller for spawning groups of units units after delays.
 
BloodSystem mBloodSystem
 

Detailed Description

Playable level of the game.

Member Function Documentation

void Level::autofireProjectile ( shared_ptr< Projectile > const &  projectile) const
private

Used to handle unfired projectile that are given to the projectile manager. Fires the projectile at the nearest enemy pawn.

Parameters
projectileThe projectile to fire. Must be unfired.
void Level::draw ( sf::RenderWindow &  w)
overridevirtual

Should draw the scene to the renderwindow

Parameters
wThe RenderWindow that the scene should be drawn to.

Implements I_Scene.

bool Level::handleEvent ( sf::Event &  Event)
overridevirtual
Parameters
EventThe event to be handled.
Returns
True if the event has been processed, false if the event is not processed or required.

Implements I_Scene.

void Level::update ( sf::Time const &  elapsedTime)
overridevirtual
Parameters
elapsedTimeThe amount of time that has past since the last time update was called.

Implements I_Scene.


The documentation for this class was generated from the following file: