![]() |
R-Type
2
Doom but in better
|
The EnemyBrain class represents the logic and behavior of an enemy entity. More...
#include <EnemyBrain.hpp>
Public Member Functions | |
EnemyBrain (const std::uint32_t entityId=0) | |
Default constructor. | |
EnemyBrain (const GUI::ECS::Online::EnemyBrain ©) | |
Copy constructor. | |
EnemyBrain (const std::uint32_t entityId, const GUI::ECS::Online::EnemyBrain ©) | |
Parameterized constructor that initializes with another EnemyBrain. | |
~EnemyBrain ()=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 components for the enemy and its bullet. | |
void | setPosition (const std::pair< float, float > &pos) |
Sets the position of the enemy. | |
void | setDimension (const std::pair< float, float > &size) |
Sets the dimensions of the enemy. | |
void | setHealth (const long int health) |
Sets the health of the enemy. | |
void | setVisible (const bool visible) |
Sets the visibility of the enemy. | |
void | setBulletSize (const std::pair< float, float > &size) |
Sets the size of the bullet. | |
const bool | isColliding (const GUI::ECS::Systems::Collision &second) const |
Checks if the enemy is colliding with another entity. | |
const bool | isVisible () const |
Checks if the enemy is visible. | |
void | tick () |
Updates the enemy's state and determines if it should fire a bullet. | |
const GUI::ECS::Online::Bullet | shoot (const std::uint32_t id) |
Make the enemy shoot a projectile with a defined id. | |
const GUI::ECS::Components::SpriteComponent | render () |
Renders the enemy's sprite. | |
void | update (const GUI::ECS::Online::EnemyBrain ©) |
Updates the sprite by copying another EnemyBrain. | |
EnemyBrain & | operator= (const GUI::ECS::Online::EnemyBrain ©) |
Overloads the assignment operator to copy from another EnemyBrain. | |
const bool | getVisible () const |
Gets the visibility status of the enemy. | |
const long int | getHealth () const |
Gets the health of the enemy. | |
const GUI::ECS::Online::Bullet | getBullet () const |
Gets the bullet data for the enemy. | |
const GUI::ECS::Components::SpriteComponent | getSprite () const |
Gets the sprite data for the enemy. | |
const GUI::ECS::Systems::Collision | getCollision () const |
Gets the collision data for the enemy. | |
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 |
The EnemyBrain class represents the logic and behavior of an enemy entity.
This class inherits from EntityNode and manages various aspects of an enemy's behavior, such as its sprite, position, health, and visibility.
Definition at line 40 of file EnemyBrain.hpp.
GUI::ECS::Online::EnemyBrain::EnemyBrain | ( | const std::uint32_t | entityId = 0 | ) |
Default constructor.
entityId | The unique ID of the entity. Default is 0. |
Definition at line 16 of file EnemyBrain.cpp.
GUI::ECS::Online::EnemyBrain::EnemyBrain | ( | const GUI::ECS::Online::EnemyBrain & | copy | ) |
Copy constructor.
copy | The EnemyBrain instance to copy. |
Definition at line 22 of file EnemyBrain.cpp.
GUI::ECS::Online::EnemyBrain::EnemyBrain | ( | const std::uint32_t | entityId, |
const GUI::ECS::Online::EnemyBrain & | copy ) |
Parameterized constructor that initializes with another EnemyBrain.
entityId | The unique ID of the entity. |
copy | The EnemyBrain instance to copy. |
Definition at line 27 of file EnemyBrain.cpp.
|
default |
Destructor.
const GUI::ECS::Online::Bullet GUI::ECS::Online::EnemyBrain::getBullet | ( | ) | const |
Gets the bullet data for the enemy.
Definition at line 188 of file EnemyBrain.cpp.
const GUI::ECS::Systems::Collision GUI::ECS::Online::EnemyBrain::getCollision | ( | ) | const |
Gets the collision data for the enemy.
Definition at line 198 of file EnemyBrain.cpp.
const long int GUI::ECS::Online::EnemyBrain::getHealth | ( | ) | const |
Gets the health of the enemy.
Definition at line 183 of file EnemyBrain.cpp.
const std::string GUI::ECS::Online::EnemyBrain::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 213 of file EnemyBrain.cpp.
const GUI::ECS::Components::SpriteComponent GUI::ECS::Online::EnemyBrain::getSprite | ( | ) | const |
Gets the sprite data for the enemy.
Definition at line 193 of file EnemyBrain.cpp.
const bool GUI::ECS::Online::EnemyBrain::getVisible | ( | ) | const |
Gets the visibility status of the enemy.
Definition at line 178 of file EnemyBrain.cpp.
const bool GUI::ECS::Online::EnemyBrain::isColliding | ( | const GUI::ECS::Systems::Collision & | second | ) | const |
Checks if the enemy is colliding with another entity.
second | The collision data of the other entity. |
Definition at line 90 of file EnemyBrain.cpp.
const bool GUI::ECS::Online::EnemyBrain::isVisible | ( | ) | const |
Checks if the enemy is visible.
Definition at line 122 of file EnemyBrain.cpp.
GUI::ECS::Online::EnemyBrain & GUI::ECS::Online::EnemyBrain::operator= | ( | const GUI::ECS::Online::EnemyBrain & | copy | ) |
Overloads the assignment operator to copy from another EnemyBrain.
copy | The EnemyBrain to copy data from. |
Definition at line 172 of file EnemyBrain.cpp.
const GUI::ECS::Components::SpriteComponent GUI::ECS::Online::EnemyBrain::render | ( | ) |
Renders the enemy's sprite.
Definition at line 146 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::setBulletSize | ( | const std::pair< float, float > & | size | ) |
Sets the size of the bullet.
size | The size as a pair of (width, height). |
Definition at line 85 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::setDimension | ( | const std::pair< float, float > & | size | ) |
Sets the dimensions of the enemy.
size | The dimensions as a pair of (width, height). |
Definition at line 65 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::setHealth | ( | const long int | health | ) |
Sets the health of the enemy.
health | The health value. |
Definition at line 71 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::setPosition | ( | const std::pair< float, float > & | pos | ) |
Sets the position of the enemy.
pos | The position as a pair of (x, y) coordinates. |
Definition at line 56 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::setSprite | ( | const std::shared_ptr< GUI::ECS::Components::SpriteComponent > & | sprite, |
const std::shared_ptr< GUI::ECS::Components::SpriteComponent > & | bullet ) |
Sets the sprite components for the enemy and its bullet.
sprite | The sprite for the enemy. |
bullet | The sprite for the bullet. |
Definition at line 33 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::setVisible | ( | const bool | visible | ) |
Sets the visibility of the enemy.
visible | True if visible, false otherwise. |
Definition at line 79 of file EnemyBrain.cpp.
const GUI::ECS::Online::Bullet GUI::ECS::Online::EnemyBrain::shoot | ( | const std::uint32_t | id | ) |
Make the enemy shoot a projectile with a defined id.
id | The id of the projectile |
Definition at line 134 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::tick | ( | ) |
Updates the enemy's state and determines if it should fire a bullet.
Definition at line 127 of file EnemyBrain.cpp.
void GUI::ECS::Online::EnemyBrain::update | ( | const GUI::ECS::Online::EnemyBrain & | copy | ) |
Updates the sprite by copying another EnemyBrain.
copy | The EnemyBrain to copy data from. |
Definition at line 156 of file EnemyBrain.cpp.