NerfUS game coordinator for the Nerf gun firing range
Dependencies: HardwareInterface mbed-rtos mbed
Fork of NerfUS by
Diff: source/GameModes/PrecisionMode.cpp
- Branch:
- PlayableGame
- Revision:
- 17:48474266a361
- Child:
- 18:469c8b2a9af9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/GameModes/PrecisionMode.cpp Fri Mar 17 17:19:42 2017 -0400 @@ -0,0 +1,37 @@ +#include "PrecisionMode.hpp" + +TargetInfo PrecisionMode::GetNextTarget() +{ + if (numberOfRounds-- == 0) { + return NULL; + } + TargetInfo new_target; + + currentTarget = (currentTarget + 1) % NUMBER_OF_TARGETS; + new_target.id = currentTarget; + new_target.type = TARGET_TYPE_ENEMY; + new_target.timeout_ms = 30000; //30 seconds + + return new_target; +} + +void PrecisionMode::OnTargetHit(int timeTaken) +{ + stats.numberOfHits++; + points += 2; +} +void PrecisionMode::OnTargetMiss() +{ + stats.numberOfMiss++; + points -= 5; +} + +GameStats PrecisionMode::GetStats() +{ + //Seems pretty basic... move to PlayableGame class ? + + //TODO: Complete the stats + //stats.timeTaken + //stats.averageTimePerTarget + return stats; +} \ No newline at end of file