Bomberman
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
BBM::LobbySystem Class Reference

A system to handle Health entities. More...

#include <LobbySystem.hpp>

Inheritance diagram for BBM::LobbySystem:
Collaboration diagram for BBM::LobbySystem:

Public Member Functions

void onUpdate (WAL::ViewEntity< LobbyComponent, Drawable2DComponent > &entity, std::chrono::nanoseconds dtime) override
 
void onSelfUpdate (std::chrono::nanoseconds dtime) override
 A method called after all entities that this system manage has been updated. More...
 
void unloadLobby ()
 Reset the lobby scene to it's default state. More...
 
void addAI ()
 Add an AI to the game. More...
 
void removeAI ()
 Remove an AI from the game. More...
 
 LobbySystem (WAL::Wal &wal)
 A default constructor. More...
 
 LobbySystem (const LobbySystem &)=default
 A Lobby system is copy constructable. More...
 
 ~LobbySystem () override=default
 A default destructor. More...
 
LobbySystemoperator= (const LobbySystem &)=delete
 A system is not assignable. More...
 
- Public Member Functions inherited from WAL::System< LobbyComponent, Drawable2DComponent >
 ~System () override=default
 A virtual, default, destructor. More...
 
 System (System &&) noexcept=default
 A system can be moved. More...
 
View< Dependencies... > & getView () override
 Get a view of all entities containing every dependencies of this system. More...
 
virtual void onUpdate (ViewEntity< Dependencies... > &entity, std::chrono::nanoseconds dtime)
 Update the corresponding component of the given entity. More...
 
virtual void onFixedUpdate (ViewEntity< Dependencies... > &entity)
 An alternative of onUpdate that is called every 8ms (120 times per seconds). If the system slow down, it will try to catch up. More...
 
void update (std::chrono::nanoseconds dtime) final
 Update the whole system (every entities that this system is responsible can be updated. More...
 
void fixedUpdate () final
 An alternative of update that is called every 8ms (120 times per seconds). If the system slow down, it will try to catch up. More...
 
- Public Member Functions inherited from WAL::ISystem
virtual ~ISystem ()=default
 A virtual default destructor. More...
 

Static Public Member Functions

static void addController (WAL::Entity &player, ControllableComponent::Layout layout)
 Add a controller for the player. More...
 
static void createTile (const std::shared_ptr< WAL::Scene > &drawable, WAL::Entity &player, int color, int playerCount)
 Create ingame tile. More...
 
static bool playersAreReady (WAL::Scene &scene)
 Check if every player is ready. More...
 
static void switchToGame (WAL::Wal &wal)
 Inform the engine that the next scene should be the game scene and load it. More...
 

Static Public Attributes

static std::array< std::string, 4 > colors
 

Private Member Functions

bool _canJoin ()
 
void _nextColor (WAL::ViewEntity< LobbyComponent, Drawable2DComponent > &entity)
 

Private Attributes

std::array< bool, 4 > _colorTaken = {}
 

Static Private Attributes

static std::array< RAY::Color, 4 > _rayColors
 

Additional Inherited Members

- Protected Member Functions inherited from WAL::System< LobbyComponent, Drawable2DComponent >
 System (Wal &wal)
 A system can't be instantiated, it should be derived. More...
 
 System (const System &)=default
 A system can't be instantiated, it should be derived. More...
 
Systemoperator= (const System &)=default
 A system can't be instantiated, it should be derived. More...
 
- Protected Attributes inherited from WAL::System< LobbyComponent, Drawable2DComponent >
Wal_wal
 A reference to the ECS. More...
 

Detailed Description

A system to handle Health entities.

Constructor & Destructor Documentation

◆ LobbySystem() [1/2]

BBM::LobbySystem::LobbySystem ( WAL::Wal wal)
explicit

A default constructor.

◆ LobbySystem() [2/2]

BBM::LobbySystem::LobbySystem ( const LobbySystem )
default

A Lobby system is copy constructable.

◆ ~LobbySystem()

BBM::LobbySystem::~LobbySystem ( )
overridedefault

A default destructor.

Member Function Documentation

◆ _canJoin()

bool BBM::LobbySystem::_canJoin ( )
private

◆ _nextColor()

void BBM::LobbySystem::_nextColor ( WAL::ViewEntity< LobbyComponent, Drawable2DComponent > &  entity)
private

◆ addAI()

void BBM::LobbySystem::addAI ( )

Add an AI to the game.

◆ addController()

void BBM::LobbySystem::addController ( WAL::Entity player,
ControllableComponent::Layout  layout 
)
static

Add a controller for the player.

◆ createTile()

void BBM::LobbySystem::createTile ( const std::shared_ptr< WAL::Scene > &  drawable,
WAL::Entity player,
int  color,
int  playerCount 
)
static

Create ingame tile.

◆ onSelfUpdate()

void BBM::LobbySystem::onSelfUpdate ( std::chrono::nanoseconds  dtime)
overridevirtual

A method called after all entities that this system manage has been updated.

Parameters
dtimeThe delta time.

Reimplemented from WAL::System< LobbyComponent, Drawable2DComponent >.

◆ onUpdate()

void BBM::LobbySystem::onUpdate ( WAL::ViewEntity< LobbyComponent, Drawable2DComponent > &  entity,
std::chrono::nanoseconds  dtime 
)
override

◆ operator=()

LobbySystem& BBM::LobbySystem::operator= ( const LobbySystem )
delete

A system is not assignable.

◆ playersAreReady()

bool BBM::LobbySystem::playersAreReady ( WAL::Scene scene)
static

Check if every player is ready.

Parameters
sceneThe lobby scene containing lobby players.

◆ removeAI()

void BBM::LobbySystem::removeAI ( )

Remove an AI from the game.

◆ switchToGame()

void BBM::LobbySystem::switchToGame ( WAL::Wal wal)
static

Inform the engine that the next scene should be the game scene and load it.

Parameters
walThe engine.

◆ unloadLobby()

void BBM::LobbySystem::unloadLobby ( )

Reset the lobby scene to it's default state.

Member Data Documentation

◆ _colorTaken

std::array<bool, 4> BBM::LobbySystem::_colorTaken = {}
private

◆ _rayColors

std::array< RAY::Color, 4 > BBM::LobbySystem::_rayColors
staticprivate
Initial value:
= {
BLUE,
RED,
GREEN,
YELLOW
}

◆ colors

std::array< std::string, 4 > BBM::LobbySystem::colors
static
Initial value:
= {
"blue",
"red",
"green",
"yellow"
}

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