Coordinator v2
Dependencies: NerfUSXbee PinDetect EthernetInterface JSON MFRC522 WebSocketClient mbed-rtos mbed
includes/GameCoordinator.hpp@2:019d8848cf7e, 2017-04-11 (annotated)
- Committer:
- Ismael Balafrej
- Date:
- Tue Apr 11 12:40:05 2017 -0400
- Revision:
- 2:019d8848cf7e
- Parent:
- 1:e1c5259b7d9a
Final version without allies/enemies
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ismael Balafrej |
1:e1c5259b7d9a | 1 | #pragma once |
Ismael Balafrej |
1:e1c5259b7d9a | 2 | #include <vector> |
Ismael Balafrej |
1:e1c5259b7d9a | 3 | #include "ports.hpp" |
Ismael Balafrej |
1:e1c5259b7d9a | 4 | #include "Target.hpp" |
Ismael Balafrej |
1:e1c5259b7d9a | 5 | #include "ServerData.hpp" |
Ismael Balafrej |
1:e1c5259b7d9a | 6 | #include "GameMode.hpp" |
Ismael Balafrej |
1:e1c5259b7d9a | 7 | #include "ReflexMode.hpp" |
Ismael Balafrej |
1:e1c5259b7d9a | 8 | #include "SpeedMode.hpp" |
Ismael Balafrej |
1:e1c5259b7d9a | 9 | |
Ismael Balafrej |
1:e1c5259b7d9a | 10 | class GameCoordinator |
Ismael Balafrej |
1:e1c5259b7d9a | 11 | { |
Ismael Balafrej |
1:e1c5259b7d9a | 12 | public: |
Ismael Balafrej |
1:e1c5259b7d9a | 13 | GameCoordinator(); |
Ismael Balafrej |
1:e1c5259b7d9a | 14 | |
Ismael Balafrej |
1:e1c5259b7d9a | 15 | void start_game(ServerData *configs); |
Ismael Balafrej |
1:e1c5259b7d9a | 16 | void stop_game(); |
Ismael Balafrej |
1:e1c5259b7d9a | 17 | void ticker_callback(); |
Ismael Balafrej |
1:e1c5259b7d9a | 18 | void get_next_round(); |
Ismael Balafrej |
2:019d8848cf7e | 19 | void target_hit(int time_taken); |
Ismael Balafrej |
2:019d8848cf7e | 20 | void target_miss(); |
Ismael Balafrej |
2:019d8848cf7e | 21 | |
Ismael Balafrej |
2:019d8848cf7e | 22 | void (*on_game_finish)(ServerEvent) = NULL; |
Ismael Balafrej |
1:e1c5259b7d9a | 23 | |
Ismael Balafrej |
1:e1c5259b7d9a | 24 | vector<Target> targets; |
Ismael Balafrej |
1:e1c5259b7d9a | 25 | Thread Tget_next_round; |
Ismael Balafrej |
1:e1c5259b7d9a | 26 | private: |
Ismael Balafrej |
1:e1c5259b7d9a | 27 | vector<GameMode*> game_modes; |
Ismael Balafrej |
1:e1c5259b7d9a | 28 | GameMode* current_game; |
Ismael Balafrej |
1:e1c5259b7d9a | 29 | uint16_t target_timeout = 10000; |
Ismael Balafrej |
1:e1c5259b7d9a | 30 | uint8_t number_of_targets = 10; |
Ismael Balafrej |
1:e1c5259b7d9a | 31 | Ticker ticker; |
Ismael Balafrej |
2:019d8848cf7e | 32 | Timer timer; |
Ismael Balafrej |
1:e1c5259b7d9a | 33 | }; |
Ismael Balafrej |
1:e1c5259b7d9a | 34 | |
Ismael Balafrej |
1:e1c5259b7d9a | 35 | extern GameCoordinator gameCoordinator; |