示例#1
0
        void endHittingGameHandler(object sender, HittingGameEventArgs e)            //this handler could be edited to be the handler of both games,using typeof sender object to determine which game is ended
        {
            int   scoreRec = 0, targetsDestroyedRec = 0;
            float avgTimeToKillRec = 0, accuracyRec = 0, killsPerSecRec = 0;

            targetsDestroyedH = e.TargetsDestroyed;
            clicksH           = e.Clicks;
            scoreH            = e.Score;
            killsPerSecH      = (float)Math.Round((float)targetsDestroyedH / e.TotalTime, 2);

            if (clicksH != 0)
            {
                accuracyH = (float)Math.Round((100 * ((float)targetsDestroyedH / clicksH)), 2);
            }
            else
            {
                accuracyH = -1;
            }

            if (targetsDestroyedH != 0)
            {
                avgTimeToKillH = (float)Math.Round(((float)e.TotalTime / targetsDestroyedH), 2);
            }
            else
            {
                avgTimeToKillH = -1;
            }
            ManageFile(filePath, ref scoreRec, ref targetsDestroyedRec, ref avgTimeToKillRec, ref accuracyRec, ref killsPerSecRec);
            statistics = new Pentagon(pentagono, graphicPos, scoreH, targetsDestroyedH, avgTimeToKillH, killsPerSecH, accuracyH, 0.8f, freccia, font, scoreRec, targetsDestroyedRec, accuracyRec, avgTimeToKillRec, killsPerSecRec);
        }
示例#2
0
 protected virtual void HittingGameEnded(HittingGameEventArgs e)
 {
     endHittingGame?.Invoke(this, e);
 }