Beispiel #1
0
        private void PlayLevel(LevelData levelData)
        {
            CellsField.Play(levelData);

            switch (levelData.LoseConditionType)
            {
            case LoseConditionType.LimitedTime:
                GameOverChecker = new LimitedTimeGameOverChecker(levelData.LoseConditionValue);
                break;

            case LoseConditionType.LimitedMoves:
                GameOverChecker = new LimitedMovesGameOverChecker(CellsField, levelData.LoseConditionValue);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            GameOverChecker.OnGameOver += OnGameOver;
            WinChecker        = new TargetsWinChecker(CellsField, levelData.Targets.ToList());
            WinChecker.OnWin += OnWin;

            App.Instance
            .WindowManager
            .Show <LevelInfoWindow>()
            .Initialize(GameOverChecker, WinChecker, Pause);
        }
Beispiel #2
0
        private void Clear()
        {
            if (GameOverChecker != null)
            {
                GameOverChecker.Clear();
                GameOverChecker = null;
            }

            if (WinChecker != null)
            {
                WinChecker.Clear();
                WinChecker = null;
            }

            CellsField.Clear();
            App.Instance.WindowManager.CloseAll();
        }
 public LimitedMovesGameOverChecker(CellsField cellsField, int startMovesCount)
 {
     _cellsField = cellsField;
     _cellsField.OnPlayerMadeMove += OnPlayerMadeMove;
     RemainingValue = startMovesCount;
 }
Beispiel #4
0
 public TargetsWinChecker(CellsField cellsField, List <Dto.Item> targets)
 {
     _cellsField = cellsField;
     _cellsField.OnItemDestroyed += OnItemDestroyed;
     Targets = targets;
 }