public void EndLevel(bool win) { if (GameManager.Instance.State == GameManager.GameState.Playing) { LevelEnd?.Invoke(win); } }
private void Player_PlayerDeath() { _isPlaying = false; StartCoroutine(OnPlayerDeath()); _haslost = true; numberOfAttempts++; PlayerPrefs.SetInt(_currentNumberOfAttemptsIndex, numberOfAttempts); LevelEnd?.Invoke(false); _scriptableEvent.ReloadScene(_waitTimeOnReload); }
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); }
public void LevelEnd(bool result, int Addedscore) { onLevelEnd?.Invoke(result, Addedscore); }