Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Friends | List of all members
core::system::Player Class Reference

Primary system for managing the player and their data. More...

#include <Player.hpp>

+ Inheritance diagram for core::system::Player:

Public Member Functions

 Player (Systems &owner)
 Construct a new Player system. More...
 
virtual ~Player ()=default
 Destroys the system. More...
 
bool spawnPlayer (const bl::tmap::Position &position, map::Map &map)
 Spawns the player into the world. More...
 
bool makePlayerControlled (bl::ecs::Entity entity)
 Makes the given entity controlled by the player. Only one entity may be player controlled at a time. More...
 
void removePlayerControlled (bl::ecs::Entity entity)
 Removes the PlayerControlled component from the given entity, if any. More...
 
bl::ecs::Entity player () const
 Returns the id of the player entity. More...
 
const bl::tmap::Position & position () const
 Returns the current position of the player. More...
 
void newGame (const std::string &name, player::Gender gender)
 Initializes all player data structures for a new game. More...
 
void whiteout ()
 Heals all Peoplemon and respawns at the last PC center. More...
 
player::Statestate ()
 Returns the state of the player. More...
 
const player::Statestate () const
 Returns the state of the player. More...
 
void showLantern ()
 Creates a light for the player's lantern. Keeps it updated as well. More...
 

Friends

struct bl::serial::SerializableObject< Player >
 

Detailed Description

Primary system for managing the player and their data.

Definition at line 33 of file Player.hpp.

Constructor & Destructor Documentation

◆ Player()

core::system::Player::Player ( Systems owner)

Construct a new Player system.

Parameters
ownerThe primary systems object

Definition at line 29 of file Player.cpp.

◆ ~Player()

virtual core::system::Player::~Player ( )
virtualdefault

Destroys the system.

Member Function Documentation

◆ makePlayerControlled()

bool core::system::Player::makePlayerControlled ( bl::ecs::Entity  entity)

Makes the given entity controlled by the player. Only one entity may be player controlled at a time.

Parameters
entityThe entity to receive player input
Returns
True if added, false on error

Definition at line 76 of file Player.cpp.

◆ newGame()

void core::system::Player::newGame ( const std::string &  name,
player::Gender  gender 
)

Initializes all player data structures for a new game.

Parameters
nameThe name of the player
genderThe gender of the player

Definition at line 59 of file Player.cpp.

◆ player()

bl::ecs::Entity core::system::Player::player ( ) const

Returns the id of the player entity.

Definition at line 55 of file Player.cpp.

◆ position()

const bl::tmap::Position & core::system::Player::position ( ) const

Returns the current position of the player.

Definition at line 57 of file Player.cpp.

◆ removePlayerControlled()

void core::system::Player::removePlayerControlled ( bl::ecs::Entity  entity)

Removes the PlayerControlled component from the given entity, if any.

Parameters
entityThe entity to remove player control from

Definition at line 91 of file Player.cpp.

◆ showLantern()

void core::system::Player::showLantern ( )

Creates a light for the player's lantern. Keeps it updated as well.

Definition at line 106 of file Player.cpp.

◆ spawnPlayer()

bool core::system::Player::spawnPlayer ( const bl::tmap::Position &  position,
map::Map map 
)

Spawns the player into the world.

Parameters
positionThe position to spawn at
mapThe map to spawn in
Returns
True if the player was spawned, false on error

Definition at line 32 of file Player.cpp.

◆ state() [1/2]

player::State & core::system::Player::state ( )

Returns the state of the player.

Definition at line 154 of file Player.cpp.

◆ state() [2/2]

const player::State & core::system::Player::state ( ) const

Returns the state of the player.

Definition at line 156 of file Player.cpp.

◆ whiteout()

void core::system::Player::whiteout ( )

Heals all Peoplemon and respawns at the last PC center.

Definition at line 97 of file Player.cpp.

Friends And Related Function Documentation

◆ bl::serial::SerializableObject< Player >

friend struct bl::serial::SerializableObject< Player >
friend

Definition at line 142 of file Player.hpp.

Member Data Documentation

◆ varianceConvergeRate

float core::system::Player::varianceConvergeRate

Definition at line 128 of file Player.hpp.

◆ varianceSwitchTime

float core::system::Player::varianceSwitchTime

Definition at line 129 of file Player.hpp.


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