import java.awt.*;

/**
  *This class specializes the PlayingField to the Brickles game.
  * 
  *@author John D. McGregor
  *@version 1.0
  *
  */
public class BricklesPlayingField extends PlayingField{
		//These value are used to make the walls, ceiling and floor have thickness
    		protected static int _minimumXInc = -100;
      	protected static int _minimumYInc = -100;
      	protected static int _maximumXInc = 100;
      	protected static int _maximumYInc = 100;
		protected BricklesView _theView;
		protected Paddle _thePaddle;
		protected int xPaddle;
		protected int yPaddle;
		protected Puck _thePuck;
      	protected Brick _theBrick;
		protected BrickPile _theBrickPile;

	/**
	  *The constructor for BricklesPlayingField constructs the obstacles that are
	  *the boundaries for the room. It also provides the View class with the
	  *references needed to update state.
	  *
	  *@param game is a reference to the game being played on the playingField
	  */
	public BricklesPlayingField(BricklesGame game){
		super(game);
		_theView = ((BricklesGame)_game).getView();
      	_match = ((BricklesGame)_game).getMatch();
		list.addElement(new Ceiling(this,new Point(_minimumXInc,_minimumYInc),new Dimension(_theView.getFieldWidth()+_maximumXInc,100)));
		list.addElement(new Wall(this,new Point(_minimumXInc,0),new Dimension(100,_theView.getFieldHeight()+_maximumYInc)));
		list.addElement(new Wall(this,new Point(_theView.getFieldWidth(),_minimumYInc),new Dimension(100,_theView.getFieldHeight()+_maximumYInc)));
            list.addElement(new Floor(this,new Point(_minimumXInc,_theView.getFieldHeight()),new Dimension(_theView.getFieldWidth()+_maximumXInc,100)));
		xPaddle = (int)(_theView.getFieldWidth()/2);
		yPaddle = (int)(_theView.getFieldHeight()*.75);
		_thePaddle = new Paddle(this, new Point(xPaddle,yPaddle),new Velocity(0,0));
		list.addElement(_thePaddle);
	  	_theView.setPaddle(_thePaddle);
      	_theBrickPile = new BrickPile(this,new Point(0,20),_theView);
      	list.addElement(_theBrickPile);
      	_theView.setBrickPile(_theBrickPile);
	  	_theView.repaint();
	}

	/**
	  *Accessor for the current Paddle
	  *@return the current Paddle
	  */
	public Paddle getPaddle(){
		return _thePaddle;
	}

	/**
	  *Sets a new Puck in the PLayingField
	  *@param newPuck the new Puck that will be used
	  */
	public void setPuck(Puck newPuck){
		_thePuck = newPuck;
      	_theView.setPuck(_thePuck);
	}

	/**
	  *Accessor for the BrickPile
	  *@return the current BrickPile
	  */
	public BrickPile getBrickPile(){
		return _theBrickPile;
	}

	/**
	  *Accessor for the View
	  *@return the current BricklesView
	  */
	public BricklesView getView(){
		return _theView;
	}

};
