} //end of Fixed Update /* * FUNCTION: The score is calculated and added up in Level_Score variable * CALLED BY: FixedUpdate() */ private void UpdateHUDStats() { //skip time and check the difference in milage in the duration if ((fCurrentTime - fPreviousTime) >= 0.1f) { //calculate the score float iCurrentFrameScore = (fCurrentDistance - fPreviousDistance); hInGameScriptCS.incrementLevelScore((int)iCurrentFrameScore); hMissionsControllerCS.incrementMissionCount(MissionsControllerCS.MissionTypes.Score, (int)iCurrentFrameScore); //mission score counter hGlobalAchievementControllerCS.incrementAchievementCount(GlobalAchievementControllerCS.GlobalAchievementTypes.Score, (int)iCurrentFrameScore); //global achievements counter fPreviousDistance = fCurrentDistance; fCurrentDistance = hControllerScriptCS.getCurrentMileage(); hMissionsControllerCS.incrementMissionCount(MissionsControllerCS.MissionTypes.Distance); //mission milage counter hGlobalAchievementControllerCS.incrementAchievementCount(GlobalAchievementControllerCS.GlobalAchievementTypes.Distance); //global achievements counter fPreviousTime = fCurrentTime; fCurrentTime = Time.time; } else { fCurrentDistance = hControllerScriptCS.getCurrentMileage(); //get the current mileage fCurrentTime = Time.time; } uilScoreText.text = hInGameScriptCS.getLevelScore().ToString(); //update Score on HUD uilCurrencyText.text = hPowerupsMainControllerCS.getCurrencyUnits().ToString(); //update Currency on HUD } //end of Update HUD Stats function