Exemplo n.º 1
0
    private void CheckTile()
    {
        if (!_isMoving)
        {
            return;
        }

        if (_currentTile.CurrentTileState == TileState.TRACK && _destinationTile.CurrentTileState == TileState.FILLED)
        {
            _isMoving = false;

            fieldController.FillTrack();
            fieldController.FillSmallerArea();
        }
        else
        {
            if (_destinationTile.CurrentTileState == TileState.TRACK && _destinationTile != _currentTile)
            {
                Die();
            }

            _currentTile = _destinationTile;


            if (_currentTile.CurrentTileState == TileState.EMPTY)
            {
                _currentTile.ChangeTileState(TileState.TRACK);
            }

            ChooseNextTile(_directionY, _directionX);
        }
    }