Pacman Torben Petré
Loading...
Searching...
No Matches
ConcreteFactory Class Referencefinal

#include <ConcreteFactory.h>

Inheritance diagram for ConcreteFactory:
Collaboration diagram for ConcreteFactory:

Public Member Functions

 ConcreteFactory (std::unordered_map< Layer, std::vector< std::shared_ptr< EntityView > > > &views)
 Creates a ConreteFactory that can be passed to the World. Requires a views container from LevelState to append to.
std::shared_ptr< logic::PacmanModelcreatePacMan (float x, float y, float mapWidth, float mapHeight) override
 Creates a PacmanModel and View.
std::shared_ptr< logic::ChasingGhostcreateBlinky (float x, float y, float mapWidth, float mapHeight) override
 Creates a ChasingGhost and a normal GhostView (no distinction is made between GhostViews).
std::shared_ptr< logic::AmbushGhostcreatePinky (float x, float y, float mapWidth, float mapHeight) override
 Creates an AmbushGhost and a normal GhostView (no distinction is made between GhostViews).
std::shared_ptr< logic::AmbushGhostcreateInky (float x, float y, float mapWidth, float mapHeight) override
 Creates an AmbushGhost and a normal GhostView (no distinction is made between GhostViews).
std::shared_ptr< logic::RandomGhostcreateClyde (float x, float y, float mapWidth, float mapHeight) override
 Creates a RandomGhost and a normal GhostView (no distinction is made between GhostViews).
std::shared_ptr< logic::WallModelcreateWall (float x, float y, char type) override
 Creates WallModel and View.
std::shared_ptr< logic::CoinModelcreateCoin (float x, float y) override
 Creates CoinModel and View.
std::shared_ptr< logic::FruitModelcreateFruit (float x, float y) override
 Creates FruitModel and View.
Public Member Functions inherited from logic::AbstractFactory
virtual ~AbstractFactory ()=default

Constructor & Destructor Documentation

◆ ConcreteFactory()

ConcreteFactory::ConcreteFactory ( std::unordered_map< Layer, std::vector< std::shared_ptr< EntityView > > > & views)
explicit

Creates a ConreteFactory that can be passed to the World. Requires a views container from LevelState to append to.

Parameters
viewsLevelState views container

Member Function Documentation

◆ createBlinky()

std::shared_ptr< logic::ChasingGhost > ConcreteFactory::createBlinky ( float x,
float y,
float mapWidth,
float mapHeight )
overridevirtual

Creates a ChasingGhost and a normal GhostView (no distinction is made between GhostViews).

The View will be attached as an observer to the Model. The view will also be appended to the FOREGROUND layer in the LevelState views container.

Parameters
xNormalized initial x position
yNormalized initial y position
mapWidthAmount of horizontal tiles
mapHeightAmount of vertical tiles
Returns
ChasingGhost to be used by the world

Implements logic::AbstractFactory.

◆ createClyde()

std::shared_ptr< logic::RandomGhost > ConcreteFactory::createClyde ( float x,
float y,
float mapWidth,
float mapHeight )
overridevirtual

Creates a RandomGhost and a normal GhostView (no distinction is made between GhostViews).

The View will be attached as an observer to the Model. The view will also be appended to the FOREGROUND layer in the LevelState views container.

Parameters
xNormalized initial x position
yNormalized initial y position
mapWidthAmount of horizontal tiles
mapHeightAmount of vertical tiles
Returns
RandomGhost to be used by the world

Implements logic::AbstractFactory.

◆ createCoin()

std::shared_ptr< logic::CoinModel > ConcreteFactory::createCoin ( float x,
float y )
overridevirtual

Creates CoinModel and View.

The View will be attached as an observer to the Model. The view will also be appended to the BACKGROUND layer in the LevelState views container.

Parameters
xNormalized initial x position
yNormalized initial y position
Returns
CoinModel to be used by the world

Implements logic::AbstractFactory.

◆ createFruit()

std::shared_ptr< logic::FruitModel > ConcreteFactory::createFruit ( float x,
float y )
overridevirtual

Creates FruitModel and View.

The View will be attached as an observer to the Model. The view will also be appended to the BACKGROUND layer in the LevelState views container.

Parameters
xNormalized initial x position
yNormalized initial y position
Returns
FruitModel to be used by the world

Implements logic::AbstractFactory.

◆ createInky()

std::shared_ptr< logic::AmbushGhost > ConcreteFactory::createInky ( float x,
float y,
float mapWidth,
float mapHeight )
overridevirtual

Creates an AmbushGhost and a normal GhostView (no distinction is made between GhostViews).

The View will be attached as an observer to the Model. The view will also be appended to the FOREGROUND layer in the LevelState views container.

Parameters
xNormalized initial x position
yNormalized initial y position
mapWidthAmount of horizontal tiles
mapHeightAmount of vertical tiles
Returns
AmbushGhost to be used by the world

Implements logic::AbstractFactory.

◆ createPacMan()

std::shared_ptr< logic::PacmanModel > ConcreteFactory::createPacMan ( float x,
float y,
float mapWidth,
float mapHeight )
overridevirtual

Creates a PacmanModel and View.

The View will be attached as an observer to the Model. The view will also be appended to the PACMAN layer in the LevelState views container.

Parameters
xInitial x position
yInitial y position
mapWidthAmount of horizontal tiles
mapHeightAmount of vertical tiles
Returns
PacmanModel to be used by the world

Implements logic::AbstractFactory.

◆ createPinky()

std::shared_ptr< logic::AmbushGhost > ConcreteFactory::createPinky ( float x,
float y,
float mapWidth,
float mapHeight )
overridevirtual

Creates an AmbushGhost and a normal GhostView (no distinction is made between GhostViews).

The View will be attached as an observer to the Model. The view will also be appended to the FOREGROUND layer in the LevelState views container.

Parameters
xNormalized initial x position
yNormalized initial y position
mapWidthAmount of horizontal tiles
mapHeightAmount of vertical tiles
Returns
AmbushGhost to be used by the world

Implements logic::AbstractFactory.

◆ createWall()

std::shared_ptr< logic::WallModel > ConcreteFactory::createWall ( float x,
float y,
char type )
overridevirtual

Creates WallModel and View.

The View will be attached as an observer to the Model. The view will also be appended to the BACKGROUND layer in the LevelState views container.

Parameters
xNormalized initial x position
yNormalized initial y position
typeUsed by to determine the sprite of the view and whether the model is a door
Returns
WallModel to be used by the world

Implements logic::AbstractFactory.


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