예제 #1
0
    public async void Restart()
    {
        if (state != GameState.Play)
        {
            return;
        }

        state = GameState.Draw;

        Subscribe(_lineDrawer);
        _adService.ShowBanner(AdPosition.Top).Forget();

        Analytics.CustomEvent(
            Constants.LevelRestarted,
            new Dictionary <string, object>()
        {
            { "level", _level.SceneNumber },
            { "stars", _starCount.Value },
            { "passed", _level.passed }
        }
            );

        _endOfLevel.gameObject.SetActive(false);
        _starCount.Value = 0;
        OnRestart?.Invoke();

        if (_adService.HasNextAd())
        {
            await _adService.ShowVideo();
        }
    }