![]() |
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::Demo::EnemyBrain ©) | |
Copy constructor. | |
EnemyBrain (const std::uint32_t entityId, const GUI::ECS::Demo::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. | |
const std::optional< GUI::ECS::Demo::Bullet > | tick () |
Updates the enemy's state and determines if it should fire a bullet. | |
const GUI::ECS::Components::SpriteComponent | render () |
Renders the enemy's sprite. | |
void | update (const GUI::ECS::Demo::EnemyBrain ©) |
Updates the sprite by copying another EnemyBrain. | |
EnemyBrain & | operator= (const GUI::ECS::Demo::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::Demo::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::Demo::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::Demo::EnemyBrain::EnemyBrain | ( | const GUI::ECS::Demo::EnemyBrain & | copy | ) |
Copy constructor.
copy | The EnemyBrain instance to copy. |
Definition at line 22 of file EnemyBrain.cpp.
GUI::ECS::Demo::EnemyBrain::EnemyBrain | ( | const std::uint32_t | entityId, |
const GUI::ECS::Demo::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::Demo::Bullet GUI::ECS::Demo::EnemyBrain::getBullet | ( | ) | const |
Gets the bullet data for the enemy.
Definition at line 189 of file EnemyBrain.cpp.
const GUI::ECS::Systems::Collision GUI::ECS::Demo::EnemyBrain::getCollision | ( | ) | const |
Gets the collision data for the enemy.
Definition at line 199 of file EnemyBrain.cpp.
const long int GUI::ECS::Demo::EnemyBrain::getHealth | ( | ) | const |
Gets the health of the enemy.
Definition at line 184 of file EnemyBrain.cpp.
const std::string GUI::ECS::Demo::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 214 of file EnemyBrain.cpp.
const GUI::ECS::Components::SpriteComponent GUI::ECS::Demo::EnemyBrain::getSprite | ( | ) | const |
Gets the sprite data for the enemy.
Definition at line 194 of file EnemyBrain.cpp.
const bool GUI::ECS::Demo::EnemyBrain::getVisible | ( | ) | const |
Gets the visibility status of the enemy.
Definition at line 179 of file EnemyBrain.cpp.
const bool GUI::ECS::Demo::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::Demo::EnemyBrain::isVisible | ( | ) | const |
Checks if the enemy is visible.
Definition at line 122 of file EnemyBrain.cpp.
GUI::ECS::Demo::EnemyBrain & GUI::ECS::Demo::EnemyBrain::operator= | ( | const GUI::ECS::Demo::EnemyBrain & | copy | ) |
Overloads the assignment operator to copy from another EnemyBrain.
copy | The EnemyBrain to copy data from. |
Definition at line 173 of file EnemyBrain.cpp.
const GUI::ECS::Components::SpriteComponent GUI::ECS::Demo::EnemyBrain::render | ( | ) |
Renders the enemy's sprite.
Definition at line 147 of file EnemyBrain.cpp.
void GUI::ECS::Demo::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::Demo::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::Demo::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::Demo::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::Demo::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::Demo::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 std::optional< GUI::ECS::Demo::Bullet > GUI::ECS::Demo::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::Demo::EnemyBrain::update | ( | const GUI::ECS::Demo::EnemyBrain & | copy | ) |
Updates the sprite by copying another EnemyBrain.
copy | The EnemyBrain to copy data from. |
Definition at line 157 of file EnemyBrain.cpp.