public void EndLevel(bool win)
 {
     if (GameManager.Instance.State == GameManager.GameState.Playing)
     {
         LevelEnd?.Invoke(win);
     }
 }
示例#2
0
 private void Player_PlayerDeath()
 {
     _isPlaying = false;
     StartCoroutine(OnPlayerDeath());
     _haslost = true;
     numberOfAttempts++;
     PlayerPrefs.SetInt(_currentNumberOfAttemptsIndex, numberOfAttempts);
     LevelEnd?.Invoke(false);
     _scriptableEvent.ReloadScene(_waitTimeOnReload);
 }
示例#3
0
    private IEnumerator LevelWon(float time)
    {
        _isPlaying = false;
        _hasWon    = true;
        if (numberOfAttempts < bestNumberOfAttempts || bestNumberOfAttempts == 0)
        {
            PlayerPrefs.SetInt(_bestNumberOfAttemptsIndex, numberOfAttempts);
        }
        if (_time < bestTime || bestTime == 0f)
        {
            PlayerPrefs.SetFloat(_bestTimeIndex, _time);
        }

        yield return(new WaitForSecondsRealtime(time));

        LevelEnd?.Invoke(true);
    }
示例#4
0
 public void LevelEnd(bool result, int Addedscore)
 {
     onLevelEnd?.Invoke(result, Addedscore);
 }