Ejemplo n.º 1
0
    public IEnumerator NoStarsShouldBeAwardedOnDeath()
    {
        var hpRating = _deathScreenController.SetHealthRating(0, 100);

        Assert.AreEqual(0, hpRating);

        yield return(null);
    }
Ejemplo n.º 2
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();
    }