Beispiel #1
0
    public IEnumerator GameOver(DataCollectionController.DataType reason)
    {
        _paused   = true;
        _gameOver = true;
        yield return(new WaitForSecondsRealtime(0.5f));

        if (!_gameOver)
        {
            _levelManager.Player.LogCumulativeData(reason);
        }

        _uploadComplete = false;
        _uploadModal.GetComponentInChildren <Text>().text = "Uploading Data....";
        _uploadModal.SetActive(true);

        StartCoroutine(DataCollector.ProcessUploadBacklog(progress =>
        {
            _uploadModal.GetComponentInChildren <Text>().text =
                "Uploading data: " +
                Mathf.RoundToInt(progress * 100) + "%";
            Debug.Log("Upload progress: " + progress);
            if (progress >= 1f && !_uploadComplete)
            {
                _uploadComplete = true;
                _uploadModal.SetActive(false);
            }
        }));

        string message;

        switch (reason)
        {
        case DataCollectionController.DataType.Victory:
            message = "You put out the fire! " + RandomPhrase(_victoryPhrases);
            break;

        case DataCollectionController.DataType.Death:
            message = "You're going to hurt yourself! " + RandomPhrase(_deathPhrases);
            break;

        case DataCollectionController.DataType.Timeout:
            message = "Time's up! " + RandomPhrase(_timeoutPhrases);
            break;

        default:
            message = "Game Over!";
            break;
        }

        FindObjectOfType <PlayerController>().Death();

        _deathScreenController.setMessage(message);
        _deathScreenController.setScore(_levelManager.Player.GetScore().ToString());;
        _deathScreenController.SetFlameRating(_levelManager.FireSystem.GetActiveFlames(), _levelManager.FireSystem.GetTotalFlames(), 0f, 0f);
        _deathScreenController.SetHealthRating(_levelManager.Player.GetRemainingHitPoints(), _levelManager.Player.GetStartingHealth());
        _deathScreenController.SetTimeRating(GetTimeRemaining(), _levelManager.TotalTime());
        _deathScreenController.show();
    }
Beispiel #2
0
 public void LogCumulativeData(DataCollectionController.DataType type)
 {
     _levelManager.GameMaster.DataCollector.LogData(
         Time.time
         , _levelManager.GameMaster.GetTimeRemaining().ToString()
         , _levelManager.GameMaster.TurkId.ToString()
         , _levelManager.GameMaster.SessionID.ToString()
         , _levelManager.GameMaster.TrialNumber.ToString()
         , _levelManager.GameMaster.CurrentLevel.ToString()
         , _levelManager.GameMaster.SetNumber.ToString()
         , _levelManager.GameMaster.GetHpBarType()
         , _hitPoints.ToString()
         , _totalDamageTaken.ToString()
         , _logFireExtinguished.ToString()
         , _averageEnemiesNearBy.ToString()
         , _averageNearByIntensity.ToString()
         , _averageActiveFlames.ToString()
         , _averageFps.ToString()
         , type
         );
 }