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(); } }); }
private void HandleSwipeDoneEvent() { _swipeDoneEventFilter.HandleEvents(_world, (eventData) => { SwipeDone(eventData.Direction); }); }
private void HandleGameStartEvent() { _gameStartFilter.HandleEvents(_world, (gameStart) => { _inputHelper.Clear(); _isGameActive = gameStart.IsActive; _grid.SetActive(gameStart.IsActive); }); }
private void HandleLoadEvent() { _loadEvents.HandleEvents(_world, (eventData) => { _world.State.Targets = eventData.State.Targets; _world.State.Steps = eventData.State.Steps; _world.State.ActiveWalls = eventData.State.ActiveWalls; _world.State.Score = eventData.State.Score; }); }
private void HandleClearEvent() { _clearEvents.HandleEvents(_world, (eventData) => { _world.State.Targets.Clear(); _world.State.Steps.Clear(); _world.State.ActiveWalls.Clear(); _world.State.Score = 0; }); }
private void HandleRemoveWallsEvent() { _removeWallsEvents.HandleEvents(_world, (eventData) => { _world.State.ActiveWalls = _world.State.ActiveWalls .Where((wall) => { return(!eventData.Walls.Any((w) => { return w.Column == wall.Column && w.Row == wall.Row && w.Direction == wall.Direction; })); }) .ToList(); }); }
private void HandleRemoveTargetsEvent() { _removeTargetsEvents.HandleEvents(_world, (eventData) => { _world.State.Targets = _world.State.Targets .Where((target) => { return(!eventData.Targets.Any((t) => { return t.Column == target.Column && t.Row == target.Row && t.Round == target.Round && t.Value == target.Value; })); }) .ToList(); }); }
private void HandleRemoveStepsEvent() { _removeStepsEvent.HandleEvents(_world, (eventData) => { _world.State.Steps = _world.State.Steps .Where((step) => { var stepToRemove = eventData.Steps.Find(s => { return(s.Column == step.Column && s.Row == step.Row && s.Round == step.Round && s.Number == step.Number); }); return(stepToRemove == null); }) .ToList(); }); }
private void HandleAddTargetsEvent() { _addTargetsEvents.HandleEvents(_world, (eventData) => { _world.State.Targets.AddRange(eventData.Targets); }); }
private void HandleAddStepsEvent() { _addStepsEvents.HandleEvents(_world, (eventData) => { _world.State.Steps.AddRange(eventData.Steps); }); }
private void HandleSetScoreEvent() { _setScoreEvents.HandleEvents(_world, (eventData) => { _world.State.Score = eventData.Score; }); }
private void HandleAddWallsEvent() { _addWallsEvents.HandleEvents(_world, (eventData) => { _world.State.ActiveWalls.AddRange(eventData.Walls); }); }