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 Demo
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::Demo::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::Demo::Bullet shoot() const;
139
146
152 void update(const GUI::ECS::Demo::PlayerBrain &copy);
153
162
168 const bool getVisible() const;
169
175 const long int getHealth() const;
176
182 const GUI::ECS::Demo::Bullet getBullet() const;
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 = 100;
212 GUI::ECS::Demo::Bullet _bullet;
215 };
216
225 std::ostream &operator<<(std::ostream &os, const PlayerBrain &item);
226 }
227 }
228}
File in charge of containing the logic for the bullet class.
Declaration of the EnemyBrain class and its related functionality.
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...
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 long int getHealth() const
Gets the player's health value.
void setBulletSize(const std::pair< float, float > &size)
Sets the bullet dimensions.
void setPosition(const std::pair< float, float > &pos)
Sets the player's position.
PlayerBrain & operator=(const GUI::ECS::Demo::PlayerBrain &copy)
Overloads the assignment operator to copy from another PlayerBrain.
void setVisible(const bool visible)
Sets the player's visibility state.
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 ...
const bool isColliding(const GUI::ECS::Systems::Collision &second) const
Checks if the player is colliding with another entity.
~PlayerBrain()=default
Destructor.
void setHealth(const long int health)
Sets the player's health.
void tick()
Updates the player's state for the current frame.
PlayerBrain(const std::uint32_t entityId=0)
Default constructor.
const GUI::ECS::Demo::Bullet shoot() const
Simulates the player shooting a bullet.
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 bool getVisible() const
Gets the player's visibility state.
const GUI::ECS::Components::SpriteComponent render()
Renders the player's sprite to the screen.
const bool isVisible() const
Checks if the player is currently visible.
const GUI::ECS::Systems::Collision getCollision() const
Gets the player's collision component.
void update(const GUI::ECS::Demo::PlayerBrain &copy)
Updates the player's state by copying another PlayerBrain.
void setDimension(const std::pair< float, float > &size)
Sets the player's dimensions.
const GUI::ECS::Demo::Bullet getBullet() const
Gets the player's bullet instance.
const GUI::ECS::Components::SpriteComponent getSprite() const
Gets the player's sprite component.
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:259