CCIMXDesktop
 
Loading...
Searching...
No Matches
ObstacleListManager.h
1#ifndef OBSTACLELISTMANAGER_H
2#define OBSTACLELISTMANAGER_H
3
4#include "core/ObstacleType.h"
5#include <QObject>
6
7class Obsticals;
9class BirdObsticals;
10class QMutex;
11class Dinasour;
12
17class ObstacleListManager : public QObject {
18 Q_OBJECT
19public:
24 explicit ObstacleListManager(QObject* parent = nullptr);
25
30 QList<Obsticals*> get_should_render();
31
36
40 void animate_once();
41
45 void reset_back();
46
52 bool is_intersects(Dinasour* dinasour);
53
58 QList<Obsticals*> get_pools();
59
64 void set_max_obstacle_cnt(short max_count);
65
70 int max_obstacle_cnt() const { return obs_max_count; }
71
76 int activate_obstacle_cnt() const { return activate_obsticals.size(); }
77
83
84signals:
90 void pass_a_obstacle(ObstacleType type, Obsticals* which);
91
92public slots:
97
102 void set_obstacle_speed(int speed);
103
104private:
106 std::shared_ptr<QMutex> locker;
107
109 QList<Obsticals*> activate_obsticals;
110
112 QList<CactusObsticals*> cactus_obsticals_pool;
113
115 QList<BirdObsticals*> brid_obsticals_pool;
116
118 int obs_max_count;
119
124 enum class BaseType {
125 Cactus,
126 Bird
127 };
128
135 QList<Obsticals*> query_unactivates(BaseType t, int how_many);
136
140 void init_instance_pool();
141
145 void process_internal_pass_session();
146
150 void process_random_summon_once();
151
156 int get_max_right_x_of_actives() const;
157
164 int adjustif_new_members(const QList<Obsticals*>& new_members, int start_x);
165
169 void let_bird_appear() { should_bird_appear = true; }
170
172 bool should_bird_appear { false };
173};
174
175#endif // OBSTACLELISTMANAGER_H
Represents bird obstacles in the game.
Definition BirdObsticals.h:12
CactusObsticals inherits from Obsticals and provides size and rendering control.
Definition CactusObsticals.h:13
Manages the creation, rendering, and collision detection of obstacles.
Definition ObstacleListManager.h:17
int max_obstacle_cnt() const
Gets maximum obstacle count.
Definition ObstacleListManager.h:70
bool is_intersects(Dinasour *dinasour)
Checks for collision with dinosaur.
Definition ObstacleListManager.cpp:62
int activate_obstacle_cnt() const
Gets count of active obstacles.
Definition ObstacleListManager.h:76
int get_obstacle_speed()
Gets current obstacle movement speed.
Definition ObstacleListManager.cpp:87
void set_max_obstacle_cnt(short max_count)
Sets maximum number of active obstacles.
Definition ObstacleListManager.cpp:79
void start_blank_working()
Initializes the obstacle system.
Definition ObstacleListManager.cpp:45
void set_obstacle_speed(int speed)
Sets obstacle movement speed.
Definition ObstacleListManager.cpp:153
void flush_activate_obsticals_once()
Updates active obstacles.
Definition ObstacleListManager.cpp:145
QList< Obsticals * > get_pools()
Gets all obstacle pools.
Definition ObstacleListManager.cpp:71
void reset_back()
Resets all obstacles to initial state.
Definition ObstacleListManager.cpp:57
QList< Obsticals * > get_should_render()
Gets obstacles that should be rendered.
Definition ObstacleListManager.cpp:41
void pass_a_obstacle(ObstacleType type, Obsticals *which)
Emitted when an obstacle is passed.
void animate_once()
Performs one animation frame update.
Definition ObstacleListManager.cpp:50
Base class for all obstacle objects in the game.
Definition Obsticals.h:15
Configuration constants for bird obstacles.
Configuration constants for cactus obstacles.
Configuration constants related to the dinosaur figure.