Represents a level in the game.
More...
#include <Level.h>
|
| | Level () |
| | Instantiate a level object.
|
| |
| virtual | ~Level () |
| |
| virtual void | LoadContent (ResourceManager &resourceManager) |
| | Load the content for the level, including game objects and resources.
|
| |
| virtual void | UnloadContent () |
| | Unload the content for the level.
|
| |
| virtual void | HandleInput (const InputState &input) |
| | Handle input for the level.
|
| |
| virtual void | Update (const GameTime &gameTime) |
| | Update the level.
|
| |
| virtual void | Draw (SpriteBatch &spriteBatch) |
| | Render the level, and all of the game objects within it.
|
| |
| virtual void | AddGameObject (GameObject *pGameObject) |
| | Add a game object to the level. This object will be updated, rendered, and checked for collisions.
|
| |
| virtual void | UpdateSectorPosition (GameObject *pGameObject) |
| | Update the position of a game object within the level, based on its collision sector (only objects within the same or adjacent sectors will be checked for collisions).
|
| |
| virtual void | SetGameplayScreen (GameplayScreen *pGameplayScreen) |
| | Set a reference to the gameplay screen.
|
| |
| virtual void | SpawnExplosion (GameObject *pExplodingObject) |
| | Spawn an explosion at a specific position.
|
| |
| virtual void | SetBackground (Texture *pBackground) |
| | Set the background texture for the level.
|
| |
| virtual float | GetAlpha () const |
| | Get the alpha value of the screen.
|
| |
| virtual bool | IsScreenTransitioning () const |
| | Check if the screen is transitioning.
|
| |
| template<typename T > |
| T * | GetClosestObject (const Vector2 position, const float range) |
| | Get a pointer to the closest object of a specific type.
|
| |
Represents a level in the game.
Definition at line 14 of file Level.h.
◆ Level()
Instantiate a level object.
Definition at line 32 of file Level.cpp.
◆ ~Level()
◆ AddGameObject()
| virtual void Level::AddGameObject |
( |
GameObject * | pGameObject | ) |
|
|
inlinevirtual |
Add a game object to the level. This object will be updated, rendered, and checked for collisions.
- Parameters
-
| pGameObject | A pointer to the game object to add. |
Definition at line 46 of file Level.h.
◆ Draw()
Render the level, and all of the game objects within it.
- Parameters
-
| spriteBatch | A reference to the game's sprite batch, used for rendering. |
Definition at line 243 of file Level.cpp.
◆ GetAlpha()
| float Level::GetAlpha |
( |
| ) |
const |
|
virtual |
Get the alpha value of the screen.
- Returns
- The alpha value of the screen.
Definition at line 212 of file Level.cpp.
◆ GetBackgroundAudio()
Get the background audio for the level.
- Returns
- A pointer to the audio sample to play.
Definition at line 129 of file Level.h.
◆ GetClosestObject()
| T * Level::GetClosestObject |
( |
const Vector2 | position, |
|
|
const float | range ) |
|
inline |
Get a pointer to the closest object of a specific type.
- Parameters
-
| position | The position to check from. |
| range | The maximum range to check. |
- Returns
- A pointer to the closest object of the specified type.
Definition at line 78 of file Level.h.
◆ GetCollisionManager()
Get a pointer to the collision manager.
- Returns
- A pointer to the collision manager.
Definition at line 117 of file Level.h.
◆ GetGameplayScreen()
Get a pointer to the gameplay screen.
- Returns
- A pointer to the gameplay screen.
Definition at line 121 of file Level.h.
◆ HandleInput()
| void Level::HandleInput |
( |
const InputState & | input | ) |
|
|
virtual |
Handle input for the level.
- Parameters
-
| input | The current state of all player input devices. |
Definition at line 110 of file Level.cpp.
◆ IsScreenTransitioning()
| virtual bool Level::IsScreenTransitioning |
( |
| ) |
const |
|
inlinevirtual |
Check if the screen is transitioning.
- Returns
- True if the screen is transitioning.
Definition at line 71 of file Level.h.
◆ LoadContent()
Load the content for the level, including game objects and resources.
- Parameters
-
| resourceManager | A reference to the game's resource manager, used for loading and managing game assets (resources). |
Reimplemented in Level01, and Level02.
Definition at line 88 of file Level.cpp.
◆ SetBackground()
| virtual void Level::SetBackground |
( |
Texture * | pBackground | ) |
|
|
inlinevirtual |
Set the background texture for the level.
- Parameters
-
| pBackground | A pointer to the texture to use as the background. |
Definition at line 63 of file Level.h.
◆ SetBackgroundAudio()
| virtual void Level::SetBackgroundAudio |
( |
AudioSample * | pAudio | ) |
|
|
inlineprotectedvirtual |
Set the background audio for the level.
- Parameters
-
| pAudio | A pointer to the audio sample to play. |
Definition at line 125 of file Level.h.
◆ SetGameplayScreen()
| virtual void Level::SetGameplayScreen |
( |
GameplayScreen * | pGameplayScreen | ) |
|
|
inlinevirtual |
Set a reference to the gameplay screen.
- Parameters
-
| pGameplayScreen | A pointer to the gameplay screen. |
Definition at line 55 of file Level.h.
◆ SpawnExplosion()
| void Level::SpawnExplosion |
( |
GameObject * | pExplodingObject | ) |
|
|
virtual |
Spawn an explosion at a specific position.
- Parameters
-
| position | The position to spawn the explosion at. |
Definition at line 188 of file Level.cpp.
◆ UnloadContent()
| virtual void Level::UnloadContent |
( |
| ) |
|
|
inlinevirtual |
Unload the content for the level.
Definition at line 29 of file Level.h.
◆ Update()
| void Level::Update |
( |
const GameTime & | gameTime | ) |
|
|
virtual |
Update the level.
- Parameters
-
| pGameTime | Timing values including time since last update. |
Definition at line 118 of file Level.cpp.
◆ UpdateSectorPosition()
| void Level::UpdateSectorPosition |
( |
GameObject * | pGameObject | ) |
|
|
virtual |
Update the position of a game object within the level, based on its collision sector (only objects within the same or adjacent sectors will be checked for collisions).
- Parameters
-
| pGameObject | A pointer to the game object to update. |
Definition at line 153 of file Level.cpp.
The documentation for this class was generated from the following files: