コード例 #1
0
ファイル: HUDControllerCS.cs プロジェクト: lovigame/alalei
    }    //end of 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;
        }

        //display the currency and score on the HUD
        tmHUDCurrencyText.text = hPowerupsMainControllerCS.getCurrencyUnits().ToString(); //update Currency on HUD
        tmHUDScoreText.text    = hInGameScriptCS.getLevelScore().ToString();              //update Score on HUD
    }                                                                                     //end of Update HUD Stats function