예제 #1
0
    private void HandleGameEnd()
    {
        _gameEndEventFilter.HandleEvents(_world, (eventData) =>
        {
            var directions = new List <DirectionEnum>
            {
                DirectionEnum.Top,
                DirectionEnum.Right,
                DirectionEnum.Bottom,
                DirectionEnum.Left,
            };
            var hasAvailablePosition = HasAvailablePosition(
                eventData.Column,
                eventData.Row,
                eventData.Round,
                eventData.Number,
                directions
                );
            if (!hasAvailablePosition)
            {
                ShowScoreUI(false);
                ShowGameOverScreen(true);

                _gameManager.ClearAll();
                _manager.EndGame();

                var scoreEntity = _scoreFilter.ToEntitiesList().First();
                SaveLeaderboard.AddResultAndSave(scoreEntity.Amount);

                _stateManager.Clear();
            }
        });
    }
예제 #2
0
    public void NewGame()
    {
        // add leaderboard item if have not finished game
        if (SaveState.State != null && SaveState.State.Score != 0)
        {
            SaveLeaderboard.AddResultAndSave(SaveState.State.Score);
        }

        GameStartup.LoadState = false;
        SceneManager.LoadScene(gameScene);
    }
예제 #3
0
    private void OnReloadClick()
    {
        if (SaveState.State != null && SaveState.State.Score != 0)
        {
            SaveLeaderboard.AddResultAndSave(SaveState.State.Score);
        }

        _gameManager.ClearAll();
        _manager.EndGame();
        _stateManager.Clear();

        _reload = true;
    }