RType
Lobby.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2023
3 ** R-type
4 ** File description:
5 ** R-type
6 */
7 
8 #pragma once
9 
10 #include "../AScene.hpp"
11 #include "../components/Animatable.hpp"
12 #include "../components/Drawable.hpp"
13 #include "../components/Timer.hpp"
14 #include <SFML/Window/Keyboard.hpp>
15 
16 class LobbyScene : public AScene
17 {
18  public:
19 
20  /**
21  * @brief Construct a new LobbyScene object
22  * @param serverSocket
23  */
24  explicit LobbyScene(std::shared_ptr<ServerSocket> serverSocket);
25 
26  /**
27  * @brief Destroy the LobbyScene object
28  */
29  ~LobbyScene() override = default;
30 
31 
32  /**
33  * @brief initScene, init the scene
34  */
35  void initScene();
36 
37 
38  /**
39  * @brief display, display the scene
40  *
41  * @param event
42  * @param window
43  */
44  void update(std::shared_ptr<Event> event, std::shared_ptr<Packet> packet) override;
45  void checkBulletDeletion();
47  bool allEnemiesLeftScreen();
48  bool allBulletsLeftScreen();
49  void spawnBoss();
50  void shootBoss(int nb);
51  void enemyDeletion();
52  void bulletDeletion();
53 
54  void initEntities() override;
55  void initServices() override;
56 
57  private:
58  timeval _chrono;
59  timeval _start;
60  std::shared_ptr<Event> _lastEvent;
61  timeval _bulletTriggerLimiter;
62  int _nbBullets;
63  int _nbBossBullets;
64  int _lifeBoss;
65 
66  std::tuple<int, int> _speedWave;
67  std::tuple<int, int> _numberEntityWave = {2, 5};
68  std::tuple<int, int> _timeBetweenWave;
69  bool _spawnerActive = true;
70  bool _bossActive = false;
71  int _timing = 0;
72 };