Esempio n. 1
0
        public IGameBlock CreateGameBlock(
            GameBlockType gameBlockType,
            int row,
            int column,
            MovementDirection changeDirection = MovementDirection.Down,
            int numberOfMultipleMoves         = 2,
            int preferredMaxMoves             = 0)
        {
            IGameBlock gameBlock;

            switch (gameBlockType)
            {
            case GameBlockType.Null:
                gameBlock = new GameBlockNull(this, row, column);
                break;

            case GameBlockType.Normal:
                gameBlock = new GameBlockNormal(this, row, column);
                break;

            case GameBlockType.Player:
                gameBlock = new GameBlockPlayer(this, row, column, preferredMaxMoves);
                break;

            case GameBlockType.ChangeDirection:
                gameBlock = new GameBlockChangeDirection(this, row, column);
                (gameBlock as GameBlockChangeDirection).ForceDirection = changeDirection;
                break;

            case GameBlockType.ExtraMove:
                gameBlock = new GameBlockExtraMove(this, row, column);
                break;

            case GameBlockType.MultipleMoves:
                gameBlock = new GameBlockMultipleMoves(this, row, column);
                (gameBlock as GameBlockMultipleMoves).NumberOfMovesNeeded  = numberOfMultipleMoves;
                (gameBlock as GameBlockMultipleMoves).NumberOfMovesApplied = numberOfMultipleMoves;
                break;

            default:
                throw new ArgumentOutOfRangeException("gameBlockType");
            }

            return(gameBlock);
        }
Esempio n. 2
0
        public override object Clone()
        {
            GameBlockNull clone = new GameBlockNull(this.IndexRow, this.IndexColumn);

            return(clone);
        }