NerfUS game coordinator for the Nerf gun firing range

Dependencies:   HardwareInterface mbed-rtos mbed

Fork of NerfUS by NerfUS

source/GameModes/PrecisionMode.cpp

Committer:
Ismael Balafrej
Date:
2017-03-17
Branch:
PlayableGame
Revision:
17:48474266a361
Child:
18:469c8b2a9af9

File content as of revision 17:48474266a361:

#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;
}