RhythmGame 1.4.3
Loading...
Searching...
No Matches
ChartStartGate.h
Go to the documentation of this file.
1#ifndef RHYTHMGAME_CHARTSTARTGATE_H
2#define RHYTHMGAME_CHARTSTARTGATE_H
3
4namespace gameplay_logic {
5
11{
12 bool held{};
13 bool pendingStart{};
14
15 public:
16 void hold() { held = true; }
17
18 [[nodiscard]] auto requestStart(bool ready) -> bool
19 {
20 pendingStart = true;
21 if (held || !ready) {
22 return false;
23 }
24 pendingStart = false;
25 return true;
26 }
27
28 [[nodiscard]] auto onReady() -> bool
29 {
30 if (held || !pendingStart) {
31 return false;
32 }
33 pendingStart = false;
34 return true;
35 }
36
37 [[nodiscard]] auto release(bool ready) -> bool
38 {
39 held = false;
40 if (!ready || !pendingStart) {
41 return false;
42 }
43 pendingStart = false;
44 return true;
45 }
46
47 void reset()
48 {
49 held = false;
50 pendingStart = false;
51 }
52
53 [[nodiscard]] auto isHeld() const -> bool { return held; }
54 [[nodiscard]] auto hasPendingStart() const -> bool { return pendingStart; }
55};
56
57} // namespace gameplay_logic
58
59#endif // RHYTHMGAME_CHARTSTARTGATE_H
Definition ChartStartGate.h:11
auto onReady() -> bool
Definition ChartStartGate.h:28
auto hasPendingStart() const -> bool
Definition ChartStartGate.h:54
void hold()
Definition ChartStartGate.h:16
auto isHeld() const -> bool
Definition ChartStartGate.h:53
auto release(bool ready) -> bool
Definition ChartStartGate.h:37
auto requestStart(bool ready) -> bool
Definition ChartStartGate.h:18
void reset()
Definition ChartStartGate.h:47
Classes and functions mostly related to gameplay.
Definition ArenaGameplaySource.h:10