Arcade Shooter
Public Member Functions | Protected Member Functions | List of all members
ShooterLibrary::Level Class Referenceabstract

Base class for all shooter levels. More...

#include <Level.h>

Inheritance diagram for ShooterLibrary::Level:
Sample::Level Sample::Level01

Public Member Functions

virtual void LoadContent (ResourceManager *pResourceManager)
 Called when resources need to be loaded. More...
 
virtual void UnloadContent ()
 Called when resources need to be unloaded. Override this method to unload any game-specific resources.
 
virtual void Update (const GameTime *pGameTime)
 Called when the game has determined that game logic needs to be processed. More...
 
virtual void Draw (SpriteBatch *pSpriteBatch)
 Called when the game determines it is time to draw a frame. More...
 
virtual void AddGameObject (GameObject *pGameObject)
 Adds a game object so it can be managed by the level. More...
 
virtual void Complete ()
 Should be called when the victory conditions are met for the level.
 
virtual void UpdateSectorPosition (GameObject *pGameObject)
 Updates an object's position on the sector grid. More...
 
template<typename T >
T * GetClosestObject (const Vector2 position, const float range)
 Get the closest active game object of a specific type. More...
 

Protected Member Functions

virtual void InitializeCollisionManager ()
 Initailizes the level's default CollisionManager.
 
virtual CollisionManagerGetCollisionManager ()
 Gets the CollisionManager for testing collisions between game objects. More...
 
virtual ParticleManager * GetParticleManager () const =0
 Gets the ParticleManager for loading the level's resources. More...
 
virtual void AddProjectilePool (ProjectilePool *pProjectilePool)
 Adds a pool of projectiles to the level. More...
 
virtual void SetBackground (Background *pBackground)
 Sets the background object for the level. More...
 

Detailed Description

Base class for all shooter levels.

Member Function Documentation

◆ AddGameObject()

virtual void ShooterLibrary::Level::AddGameObject ( GameObject pGameObject)
inlinevirtual

Adds a game object so it can be managed by the level.

Parameters
pGameObjectA pointer to the GameObject that will be added to the level.

◆ AddProjectilePool()

virtual void ShooterLibrary::Level::AddProjectilePool ( ProjectilePool pProjectilePool)
inlineprotectedvirtual

Adds a pool of projectiles to the level.

Parameters
pProjectilePoolThe pool to add.

◆ Draw()

virtual void ShooterLibrary::Level::Draw ( SpriteBatch *  pSpriteBatch)
virtual

Called when the game determines it is time to draw a frame.

Parameters
pSpriteBatchThe game's sprite batch, used for rendering.

Reimplemented in Sample::Level.

◆ GetClosestObject()

template<typename T >
T* ShooterLibrary::Level::GetClosestObject ( const Vector2  position,
const float  range 
)
inline

Get the closest active game object of a specific type.

Parameters
positionThe position from which to determine the closest object.
rangeThe maximum distance to allow the search to return an object. If the range is negative or zero, the diagonal screen size is used.
Returns
Returns a game object of the specified type T, or nullptr if a matching object was not found.

◆ GetCollisionManager()

virtual CollisionManager* ShooterLibrary::Level::GetCollisionManager ( )
inlineprotectedvirtual

Gets the CollisionManager for testing collisions between game objects.

Returns
Returns a pointer to the CollisionManager.

◆ GetParticleManager()

virtual ParticleManager* ShooterLibrary::Level::GetParticleManager ( ) const
protectedpure virtual

Gets the ParticleManager for loading the level's resources.

Returns
Returns a pointer to the ResourceManager.

Implemented in Sample::Level.

◆ LoadContent()

virtual void ShooterLibrary::Level::LoadContent ( ResourceManager *  pResourceManager)
virtual

Called when resources need to be loaded.

Parameters
pResourceManagerThe game's resource manager, used for loading and managing game resources.

Reimplemented in Sample::Level, and Sample::Level01.

◆ SetBackground()

virtual void ShooterLibrary::Level::SetBackground ( Background pBackground)
inlineprotectedvirtual

Sets the background object for the level.

Parameters
pBackgroundThe level's background.

◆ Update()

virtual void ShooterLibrary::Level::Update ( const GameTime *  pGameTime)
virtual

Called when the game has determined that game logic needs to be processed.

Parameters
pGameTimeTiming values including time since last update.

Reimplemented in Sample::Level.

◆ UpdateSectorPosition()

void ShooterLibrary::Level::UpdateSectorPosition ( GameObject pGameObject)
virtual

Updates an object's position on the sector grid.

Parameters
pGameObjectThe game object who's position will be updated.
Remarks
This should happen automatically as long as a game object's Update() calls GameObject::Update().

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