Coordinator v2

Dependencies:   NerfUSXbee PinDetect EthernetInterface JSON MFRC522 WebSocketClient mbed-rtos mbed

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?

UserRevisionLine numberNew contents of line
Ismael Balafrej 1:e1c5259b7d9a 1 #pragma once
Ismael Balafrej 1:e1c5259b7d9a 2 #include "GameMode.hpp"
Ismael Balafrej 1:e1c5259b7d9a 3
Ismael Balafrej 1:e1c5259b7d9a 4 class ReflexMode : public GameMode
Ismael Balafrej 1:e1c5259b7d9a 5 {
Ismael Balafrej 1:e1c5259b7d9a 6 public:
Ismael Balafrej 1:e1c5259b7d9a 7 using GameMode::GameMode;
Ismael Balafrej 1:e1c5259b7d9a 8 Target* GetNextTarget()
Ismael Balafrej 1:e1c5259b7d9a 9 {
Ismael Balafrej 1:e1c5259b7d9a 10 return GetRandomTarget();
Ismael Balafrej 1:e1c5259b7d9a 11 }
Ismael Balafrej 1:e1c5259b7d9a 12 void OnTargetHit(int timeTaken)
Ismael Balafrej 1:e1c5259b7d9a 13 {
Ismael Balafrej 1:e1c5259b7d9a 14 stats.targets++;
Ismael Balafrej 2:019d8848cf7e 15 stats.score += 2;
Ismael Balafrej 1:e1c5259b7d9a 16 }
Ismael Balafrej 1:e1c5259b7d9a 17 void OnTargetMiss()
Ismael Balafrej 1:e1c5259b7d9a 18 {
Ismael Balafrej 1:e1c5259b7d9a 19 stats.score -= 1;
Ismael Balafrej 1:e1c5259b7d9a 20 }
Ismael Balafrej 1:e1c5259b7d9a 21 int getTimeBetweenTargets()
Ismael Balafrej 1:e1c5259b7d9a 22 {
Ismael Balafrej 2:019d8848cf7e 23 return (rand() % 3000) + 1000;
Ismael Balafrej 1:e1c5259b7d9a 24 }
Ismael Balafrej 1:e1c5259b7d9a 25 };