1 #ifndef CORE_SYSTEMS_PLAYER_HPP
2 #define CORE_SYSTEMS_PLAYER_HPP
4 #include <BLIB/ECS.hpp>
5 #include <BLIB/Engine/System.hpp>
6 #include <BLIB/Events.hpp>
7 #include <BLIB/Tilemap/Position.hpp>
34 :
public bl::engine::System
35 ,
public bl::event::Listener<event::GameSaveInitializing, event::EntityMoveFinished> {
78 bl::ecs::Entity
player()
const;
84 const bl::tmap::Position&
position()
const;
120 bl::ecs::Entity playerId;
121 bl::tmap::Position* _position;
124 bl::rc::lgt::Light2D lantern;
125 float lanternVariance;
126 float lanternTargetVariance;
137 void updateLantern(
float dt);
138 void startLanternVarianceHold();
139 void startLanternVarianceChange();
141 virtual void init(bl::engine::Engine&)
override;
142 virtual void update(std::mutex&,
float dt,
float,
float,
float)
override;
144 friend struct bl::serial::SerializableObject<
Player>;
Gender
Possible genders for the player.
Core classes and functionality for both the editor and game.
Adding this component to an entity will allow it to move.
Fired when an entity completes a move from one tile to another.
Fired when the game is saving or loading. Allows systems to hook in their data.
The primary map class that represents a usable map in the game.
Primary system for managing the player and their data.
float varianceConvergeRate
void showLantern()
Creates a light for the player's lantern. Keeps it updated as well.
player::State & state()
Returns the state of the player.
Player(Systems &owner)
Construct a new Player system.
void newGame(const std::string &name, player::Gender gender)
Initializes all player data structures for a new game.
const bl::tmap::Position & position() const
Returns the current position of the player.
virtual ~Player()=default
Destroys the system.
void whiteout()
Heals all Peoplemon and respawns at the last PC center.
void removePlayerControlled(bl::ecs::Entity entity)
Removes the PlayerControlled component from the given entity, if any.
bool spawnPlayer(const bl::tmap::Position &position, map::Map &map)
Spawns the player into the world.
bl::ecs::Entity player() const
Returns the id of the player entity.
bool makePlayerControlled(bl::ecs::Entity entity)
Makes the given entity controlled by the player. Only one entity may be player controlled at a time.
Owns all primary systems and a reference to the engine.