![]() |
R-Type
2
Doom but in better
|
Forward declaration of the Bullet class. More...
#include <PlayerBrain.hpp>
Public Member Functions | |
PlayerBrain (const std::uint32_t entityId=0) | |
Default constructor. | |
PlayerBrain (const GUI::ECS::Online::PlayerBrain ©) | |
Copy constructor. | |
PlayerBrain (const std::uint32_t entityId, const GUI::ECS::Online::PlayerBrain ©) | |
Construct a new PlayerBrain object with an entity ID and a copy of another instance. | |
~PlayerBrain ()=default | |
Destructor. | |
void | setSprite (const std::shared_ptr< GUI::ECS::Components::SpriteComponent > &sprite, const std::shared_ptr< GUI::ECS::Components::SpriteComponent > &bullet) |
Sets the sprite and bullet sprite components for the player. | |
void | setPosition (const std::pair< float, float > &pos) |
Sets the player's position. | |
void | setDimension (const std::pair< float, float > &size) |
Sets the player's dimensions. | |
void | setHealth (const long int health) |
Sets the player's health. | |
void | setVisible (const bool visible) |
Sets the player's visibility state. | |
void | setBulletSize (const std::pair< float, float > &size) |
Sets the bullet dimensions. | |
const bool | isColliding (const GUI::ECS::Systems::Collision &second) const |
Checks if the player is colliding with another entity. | |
const bool | isVisible () const |
Checks if the player is currently visible. | |
void | tick () |
Updates the player's state for the current frame. | |
const GUI::ECS::Online::Bullet | shoot (const std::uint32_t id) const |
Simulates the player shooting a bullet. | |
const GUI::ECS::Components::SpriteComponent | render () |
Renders the player's sprite to the screen. | |
void | update (const GUI::ECS::Online::PlayerBrain ©) |
Updates the player's state by copying another PlayerBrain. | |
PlayerBrain & | operator= (const GUI::ECS::Online::PlayerBrain ©) |
Overloads the assignment operator to copy from another PlayerBrain. | |
const bool | getVisible () const |
Gets the player's visibility state. | |
const long int | getHealth () const |
Gets the player's health value. | |
const GUI::ECS::Online::Bullet | getBullet () const |
Gets the player's bullet instance. | |
const GUI::ECS::Components::SpriteComponent | getSprite () const |
Gets the player's sprite component. | |
const GUI::ECS::Systems::Collision | getCollision () const |
Gets the player's collision component. | |
const std::string | getInfo (const unsigned int indent=0) const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes. | |
![]() | |
EntityNode (const size_t entityId=0) | |
virtual | ~EntityNode ()=default |
virtual size_t | getEntityNodeId () const |
Additional Inherited Members | |
![]() | |
size_t | _entityID |
Forward declaration of the Bullet class.
The PlayerBrain class manages the player's logic, interactions, and rendering.
This class is responsible for handling player-related behaviors, including shooting, collision detection, visibility, and rendering.
Definition at line 40 of file PlayerBrain.hpp.
GUI::ECS::Online::PlayerBrain::PlayerBrain | ( | const std::uint32_t | entityId = 0 | ) |
Default constructor.
entityId | The unique ID of the entity. Default is 0. |
Definition at line 16 of file PlayerBrain.cpp.
GUI::ECS::Online::PlayerBrain::PlayerBrain | ( | const GUI::ECS::Online::PlayerBrain & | copy | ) |
Copy constructor.
copy | The PlayerBrain instance to copy from. |
Definition at line 22 of file PlayerBrain.cpp.
GUI::ECS::Online::PlayerBrain::PlayerBrain | ( | const std::uint32_t | entityId, |
const GUI::ECS::Online::PlayerBrain & | copy ) |
Construct a new PlayerBrain object with an entity ID and a copy of another instance.
entityId | The unique ID of the entity. |
copy | The PlayerBrain instance to copy from. |
Definition at line 27 of file PlayerBrain.cpp.
|
default |
Destructor.
const GUI::ECS::Online::Bullet GUI::ECS::Online::PlayerBrain::getBullet | ( | ) | const |
Gets the player's bullet instance.
Definition at line 188 of file PlayerBrain.cpp.
const GUI::ECS::Systems::Collision GUI::ECS::Online::PlayerBrain::getCollision | ( | ) | const |
Gets the player's collision component.
Definition at line 198 of file PlayerBrain.cpp.
const long int GUI::ECS::Online::PlayerBrain::getHealth | ( | ) | const |
Gets the player's health value.
Definition at line 183 of file PlayerBrain.cpp.
const std::string GUI::ECS::Online::PlayerBrain::getInfo | ( | const unsigned int | indent = 0 | ) | const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.
indent | The level to which the class should be indented in the dump. |
Definition at line 203 of file PlayerBrain.cpp.
const GUI::ECS::Components::SpriteComponent GUI::ECS::Online::PlayerBrain::getSprite | ( | ) | const |
Gets the player's sprite component.
Definition at line 193 of file PlayerBrain.cpp.
const bool GUI::ECS::Online::PlayerBrain::getVisible | ( | ) | const |
Gets the player's visibility state.
Definition at line 178 of file PlayerBrain.cpp.
const bool GUI::ECS::Online::PlayerBrain::isColliding | ( | const GUI::ECS::Systems::Collision & | second | ) | const |
Checks if the player is colliding with another entity.
second | The collision system to check against. |
Definition at line 91 of file PlayerBrain.cpp.
const bool GUI::ECS::Online::PlayerBrain::isVisible | ( | ) | const |
Checks if the player is currently visible.
Definition at line 123 of file PlayerBrain.cpp.
GUI::ECS::Online::PlayerBrain & GUI::ECS::Online::PlayerBrain::operator= | ( | const GUI::ECS::Online::PlayerBrain & | copy | ) |
Overloads the assignment operator to copy from another PlayerBrain.
copy | The PlayerBrain to copy data from. |
Definition at line 172 of file PlayerBrain.cpp.
const GUI::ECS::Components::SpriteComponent GUI::ECS::Online::PlayerBrain::render | ( | ) |
Renders the player's sprite to the screen.
Definition at line 146 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::setBulletSize | ( | const std::pair< float, float > & | size | ) |
Sets the bullet dimensions.
size | A pair of (width, height) dimensions for the bullet. |
Definition at line 86 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::setDimension | ( | const std::pair< float, float > & | size | ) |
Sets the player's dimensions.
size | A pair of (width, height) dimensions. |
Definition at line 66 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::setHealth | ( | const long int | health | ) |
Sets the player's health.
health | The health value to set. |
Definition at line 72 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::setPosition | ( | const std::pair< float, float > & | pos | ) |
Sets the player's position.
pos | A pair of (x, y) coordinates representing the position. |
Definition at line 57 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::setSprite | ( | const std::shared_ptr< GUI::ECS::Components::SpriteComponent > & | sprite, |
const std::shared_ptr< GUI::ECS::Components::SpriteComponent > & | bullet ) |
Sets the sprite and bullet sprite components for the player.
sprite | The player's sprite component. |
bullet | The player's bullet sprite component. |
Definition at line 34 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::setVisible | ( | const bool | visible | ) |
Sets the player's visibility state.
visible | True if the player should be visible, false otherwise. |
Definition at line 80 of file PlayerBrain.cpp.
const GUI::ECS::Online::Bullet GUI::ECS::Online::PlayerBrain::shoot | ( | const std::uint32_t | id | ) | const |
Simulates the player shooting a bullet.
Definition at line 135 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::tick | ( | ) |
Updates the player's state for the current frame.
Definition at line 129 of file PlayerBrain.cpp.
void GUI::ECS::Online::PlayerBrain::update | ( | const GUI::ECS::Online::PlayerBrain & | copy | ) |
Updates the player's state by copying another PlayerBrain.
Updates the sprite by copying another PlayerBrain.
copy | The PlayerBrain instance to copy data from. |
copy | The PlayerBrain to copy data from. |
Definition at line 156 of file PlayerBrain.cpp.