Game Engine 2D Platformer
Public Member Functions | Public Attributes | List of all members
EntityManager Class Reference

EntityManager class that stores all entities within the game. More...

#include <EntityManager.hpp>

Public Member Functions

 EntityManager ()=default
 Constructor of EntityManager. More...
 
void AddEntity (entityType name, std::shared_ptr< GameEntity > entity)
 Add an entity to the Class. More...
 
void ClearVector (entityType name)
 Removing a particular entity from the Class. More...
 
std::vector< std::shared_ptr< GameEntity > > GetEntityVector (entityType name)
 Returns the EntityVector of the class that stores the entities. More...
 

Public Attributes

std::map< entityType, std::vector< std::shared_ptr< GameEntity > > > gameEntities
 

Detailed Description

EntityManager class that stores all entities within the game.

Constructor & Destructor Documentation

◆ EntityManager()

EntityManager::EntityManager ( )
default

Constructor of EntityManager.

Member Function Documentation

◆ AddEntity()

void EntityManager::AddEntity ( entityType  name,
std::shared_ptr< GameEntity entity 
)

Add an entity to the Class.

Adds an entity to the appropriate vector of Entity Types.

Parameters
nameAn enum of type entityType
entityA shared pointer to GameEntity Object
entityTypename
std::shared_ptr<GameEntity>entity

◆ ClearVector()

void EntityManager::ClearVector ( entityType  name)

Removing a particular entity from the Class.

Clears the vector of items with pass entityType.

Parameters
nameAn enum of type entityType
entityTypename

◆ GetEntityVector()

std::vector< std::shared_ptr< GameEntity > > EntityManager::GetEntityVector ( entityType  name)

Returns the EntityVector of the class that stores the entities.

Returns the vector of the passed entityType. If it does not exist, it returns an empty vectors.

Parameters
nameAn enum of type entityType
Returns
Entity Vector
Parameters
entityTypename
Returns
std::vector<std::shared_ptr<GameEntity>>

Member Data Documentation

◆ gameEntities

std::map<entityType, std::vector<std::shared_ptr<GameEntity> > > EntityManager::gameEntities

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