My Project
HitboxSystem.hpp
1 /*
2 ** EPITECH PROJECT, 2022
3 ** B-CPP-500-PAR-5-1-rtype-martin.vanaud
4 ** File description:
5 ** HitboxSystem
6 */
7 
8 #ifndef HITBOXSYSTEM_HPP_
9  #define HITBOXSYSTEM_HPP_
10 
11  /* Ecs */
12  #include "Registry.hpp"
13 
14  /* Component */
15  #include "Component/CType.hpp"
16  #include "Component/CPosition.hpp"
17  #include "Component/CRect.hpp"
18  #include "Component/CNetworkQueue.hpp"
19  #include "Component/CHealth.hpp"
20  #include "Component/CLobbyId.hpp"
21  #include "Component/CScore.hpp"
22  #include "Component/COwnerId.hpp"
23 
27 namespace System {
31  class HitboxSystem {
32  public:
36  HitboxSystem();
37  ~HitboxSystem() = default;
38 
49  bool CheckCollision(component::crect_t const &rec1, component::crect_t const &rec2, component::cposition_t const &pos1, component::cposition_t const &pos2);
50 
64  void operator()(
65  Registry &registry,
75  );
76 
88  void doHealthCheck(Registry &registry, component::cnetwork_queue_t &netQueue, component::chealth_t &health1, component::chealth_t &health2, component::clobby_id_t &lobbyId, int i, int x, ENTITY_TYPE &entityType);
100 
101  protected:
102  private:
103  };
104 };
105 
106 #endif /* !HITBOXSYSTEM_HPP_ */
component::cposition_t
A structure representing the position component that holds the position of an entity.
Definition: CPosition.hpp:18
Sparse_array
Class that handle Element of type Component like a vector which can be holed.
Definition: SparseArray.hpp:22
System
Namespace for systems.
Definition: DirectionSystem.hpp:24
System::HitboxSystem::doHealthCheck
void doHealthCheck(Registry &registry, component::cnetwork_queue_t &netQueue, component::chealth_t &health1, component::chealth_t &health2, component::clobby_id_t &lobbyId, int i, int x, ENTITY_TYPE &entityType)
A method to check if a collision happened between a player and a bullet.
Definition: HitboxSystem.cpp:28
System::HitboxSystem::doScoreUpdate
void doScoreUpdate(component::cnetwork_queue_t &netQueue, component::clobby_id_t &lobbyId, Sparse_array< component::cscore_t > &score, Sparse_array< component::ctype_t > &type, Sparse_array< component::cowner_id_t > &ownerId, int x)
A method to check if a collision happened between a player and a bonus.
Definition: HitboxSystem.cpp:46
component::chealth_t
A structure representing the health component that holds the healt of the entity.
Definition: CHealth.hpp:18
System::HitboxSystem::CheckCollision
bool CheckCollision(component::crect_t const &rec1, component::crect_t const &rec2, component::cposition_t const &pos1, component::cposition_t const &pos2)
A method to check if a collision happened.
Definition: HitboxSystem.cpp:56
Registry
Class that handle ECS.
Definition: Registry.hpp:22
component::cnetwork_queue_t
A structure representing the queue use by the ECS to send the request to the server.
Definition: CNetworkQueue.hpp:29
System::HitboxSystem
The Hitbox System class, it handles everything related to collisions between entities.
Definition: HitboxSystem.hpp:31
System::HitboxSystem::HitboxSystem
HitboxSystem()
Construct a new Hitbox System object.
Definition: HitboxSystem.cpp:24
component::crect_t
A structure representing the rectangle component that holds the rectangle of an entity.
Definition: CRect.hpp:18
component::clobby_id_t
A structure representing the lobby id where the entity is.
Definition: CLobbyId.hpp:25
System::HitboxSystem::operator()
void operator()(Registry &registry, Sparse_array< component::cnetwork_queue_t > &network_queues, Sparse_array< component::ctype_t > &types, Sparse_array< component::cposition_t > &positions, Sparse_array< component::crect_t > &rects, Sparse_array< component::chealth_t > &health, Sparse_array< component::clobby_id_t > &lobbyId, Sparse_array< component::cscore_t > &score, Sparse_array< component::ctype_t > &type, Sparse_array< component::cowner_id_t > &ownerId)
The main handler for the Hitbox System.