R-Type  2
Doom but in better
Loading...
Searching...
No Matches
PlayerBrain.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2024
3** rtype (Workspace)
4** File description:
5** PlayerBrain.hpp
6*/
7
16#pragma once
17#include "Log.hpp"
18#include "Recoded.hpp"
19#include "LogMacros.hpp"
20#include "Utilities.hpp"
25
26namespace GUI
27{
28 namespace ECS
29 {
30 namespace Online
31 {
32 class EnemyBrain;
33 class Bullet;
34
40 class PlayerBrain : public EntityNode {
41 public:
47 PlayerBrain(const std::uint32_t entityId = 0);
48
55
62 PlayerBrain(const std::uint32_t entityId, const GUI::ECS::Online::PlayerBrain &copy);
63
67 ~PlayerBrain() = default;
68
75 void setSprite(const std::shared_ptr<GUI::ECS::Components::SpriteComponent> &sprite, const std::shared_ptr<GUI::ECS::Components::SpriteComponent> &bullet);
76
82 void setPosition(const std::pair<float, float> &pos);
83
89 void setDimension(const std::pair<float, float> &size);
90
96 void setHealth(const long int health);
97
103 void setVisible(const bool visible);
104
110 void setBulletSize(const std::pair<float, float> &size);
111
119 const bool isColliding(const GUI::ECS::Systems::Collision &second) const;
120
126 const bool isVisible() const;
127
131 void tick();
132
138 const GUI::ECS::Online::Bullet shoot(const std::uint32_t id) const;
139
146
152 void update(const GUI::ECS::Online::PlayerBrain &copy);
153
162
168 const bool getVisible() const;
169
175 const long int getHealth() const;
176
183
190
197
207 const std::string getInfo(const unsigned int indent = 0) const;
208
209 private:
210 bool _visible = true;
211 long int _health = 3;
215 };
216
225 std::ostream &operator<<(std::ostream &os, const PlayerBrain &item);
226 }
227 }
228}
This is the file that links the EntityNode children.
Macro definitions for logging messages with varying levels of detail and formatting.
This is the file in charge of containing the Log class (the one in charge of outputing info only when...
File in charge of containing the logic for the bullet class.
Declaration of the EnemyBrain class and its related functionality.
This is an agglomerator in which all the files from Recoded folder will be included.
This is the file that contains the class in charge of managing a sprite.
Represents a drawable and interactive sprite in the ECS system.
Represents a bullet entity in the game.
Definition Bullet.hpp:31
Forward declaration of the Bullet class.
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 ...
~PlayerBrain()=default
Destructor.
void setDimension(const std::pair< float, float > &size)
Sets the player's dimensions.
const GUI::ECS::Online::Bullet shoot(const std::uint32_t id) const
Simulates the player shooting a bullet.
PlayerBrain & operator=(const GUI::ECS::Online::PlayerBrain &copy)
Overloads the assignment operator to copy from another PlayerBrain.
PlayerBrain(const std::uint32_t entityId=0)
Default constructor.
const bool isVisible() const
Checks if the player is currently visible.
void tick()
Updates the player's state for the current frame.
void update(const GUI::ECS::Online::PlayerBrain &copy)
Updates the player's state by copying another PlayerBrain.
void setVisible(const bool visible)
Sets the player's visibility state.
const GUI::ECS::Components::SpriteComponent render()
Renders the player's sprite to the screen.
const bool getVisible() const
Gets the player's visibility state.
const GUI::ECS::Systems::Collision getCollision() const
Gets the player's collision component.
const GUI::ECS::Online::Bullet getBullet() const
Gets the player's bullet instance.
void setPosition(const std::pair< float, float > &pos)
Sets the player's position.
const bool isColliding(const GUI::ECS::Systems::Collision &second) const
Checks if the player is colliding with another entity.
const long int getHealth() const
Gets the player's health value.
void setBulletSize(const std::pair< float, float > &size)
Sets the bullet dimensions.
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.
const GUI::ECS::Components::SpriteComponent getSprite() const
Gets the player's sprite component.
void setHealth(const long int health)
Sets the player's health.
Represents a rectangular component that can detect collisions and mouse interactions,...
Definition Collision.hpp:39
std::ostream & operator<<(std::ostream &os, const Bullet &item)
Outputs the sprite's info to a stream.
Definition Bullet.cpp:260