Beispiel #1
0
    protected override void Execute(List <GameEntity> entities)
    {
        var gameBoard = _contexts.game.gameBoard;

        for (int column = 0; column < gameBoard.columns; column++)
        {
            var position   = new IntVector2(column, gameBoard.rows);
            var nextRowPos = gameBoardService.GetNextEmptyRow(position);
            while (nextRowPos != gameBoard.rows)
            {
                entityService.CreateRandomPiece(column, nextRowPos);
                nextRowPos = gameBoardService.GetNextEmptyRow(position);
            }
        }
    }
Beispiel #2
0
    void MoveDown(GameEntity e, IntVector2 position)
    {
        var nextRowPos = gameBoardService.GetNextEmptyRow(position);

        if (nextRowPos != position.y)
        {
            e.ReplaceMove(new IntVector2(position.x, nextRowPos));
        }
    }
Beispiel #3
0
    protected override void Execute(List <GameEntity> entities)
    {
        var gameBoard = _contexts.game.gameBoard;

        for (int column = 0; column < gameBoard.columns; column++)
        {
            var position  = new IntVector2(column, gameBoard.rows + 1);
            var rowPosMin = gameBoardService.GetNextEmptyRow(position);
            for (int i = rowPosMin; i < gameBoard.rows; i++)
            {
                var balls = _contexts.game.GetEntitiesWithMove(new IntVector2(position.x, i)).ToArray();
                if (balls.Length == 0)
                {
                    entityService.CreateRandomPiece(column, i);
                }
            }
        }
    }