Ejemplo n.º 1
0
    public void Initialize(int playerId)
    {
        PlayerId = playerId;
        InitializeUiUseCase.Execute(PlayerId);

        InitializeBlocksQueueService.Execute(QueueSize);
        ControlBlocks      = GetNextControlBlocksService.Execute(PlayerId);
        InputEventProvider = GetInputEventProvider();
    }
Ejemplo n.º 2
0
    public ControlBlocks Execute(IMoveControlBlocksService moveService, int playerId, ControlBlocks controlBlocks)
    {
        var movedControlBlocks = moveService.Execute(controlBlocks);

        if (PutControlBlocksService.Execute(movedControlBlocks))
        {
            EraseLineService.Execute();
            if (Board.IsGameOver())
            {
                GameOverEvent.EmitGameOver();
            }
            else
            {
                var newControlBlocks = GetNextControlBlocksService.Execute(playerId);
                return(newControlBlocks);
            }
        }
        var adjustedControlBlocks = Adjuster.AdjustBlocksByPutBlocks(movedControlBlocks);

        ControlBlocksPresenter.ChangeControlBlocks(adjustedControlBlocks);
        return(adjustedControlBlocks);
    }