NerfUS game coordinator for the Nerf gun firing range

Dependencies:   HardwareInterface mbed-rtos mbed

Fork of NerfUS by NerfUS

Branch:
PlayableGame
Revision:
19:33e8cd56630f
Parent:
18:469c8b2a9af9
--- a/include/PlayableGame.hpp	Mon Mar 27 11:15:50 2017 -0400
+++ b/include/PlayableGame.hpp	Thu Mar 30 13:40:36 2017 -0400
@@ -3,6 +3,7 @@
 #include <vector>
 #include "Target.hpp"
 #include "RandomNumberGenerator.hpp"
+#include "rtos.h"
 
 struct GameStats
 {
@@ -23,15 +24,16 @@
   virtual bool IsWeaponValid(int weaponId); //Default to any Weapons
   virtual int GetPoints();
   virtual GameStats GetStats();
+  virtual TargetInfo* GetNextTarget() = 0;
 
-  virtual TargetInfo* GetNextTarget() = 0;
   void Start(); //Create a thread that will call GetNextTarget at set speed
   void Stop(); //Stop the thread
+  int getTargetSpeed = 10; //ms
 
 protected:
   int points;
   GameStats stats;
-  TargetInfo *GetRandomTarget(int timeout_ms );
+  TargetInfo *GetRandomTarget(int timeout_ms);
   std::vector<TargetInfo>* targets;
 
   virtual void OnTargetHit(int timeTaken) = 0;
@@ -39,4 +41,6 @@
 
 private:
   RandomNumberGenerator& random_number_generator;
+  RtosTimer iteration_timer(TimerDoIteration);
+  void TimerDoIteration();
 };
\ No newline at end of file