|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBoardManager
public class BoardManager
This class manages the display, and game-play for a stratego game
Constructor Summary | |
---|---|
BoardManager()
|
Method Summary | |
---|---|
int |
calculateColumn(int X)
This Method takes a X value and calculates the column it falls under |
int |
calculateRow(int Y)
This Method takes a Y value and calculates the Row it falls in |
int |
calculateX(int column)
This Method takes a column and calculates its stating X value |
int |
calculateY(int row)
This Method takes a column and calculates its stating Y value |
boolean |
canBlueMove()
This Method checks if any of Blue's units can move |
boolean |
canRedMove()
This Method checks if any of red's units can move |
void |
deityMode()
This Method calls the deityMode Method on the selected unit |
void |
drawBoard()
This Method redraws the game board |
void |
flagReveal()
This Method calls the flagReveal Method in the StrategoBoard class |
void |
gameOver()
This Method checks which player (if any) won, and calls the appropriate method from the Stratego Game class |
int |
getGameState()
This Method returns the integer representation of the game state |
StrategoPiece |
getSelectedPiece()
This Method returns the active StrategoPiece Object |
StrategoBoard |
getStrategoBoard()
This Method returns the active StrategoBoard Object |
void |
hideBlue()
This Method sets all of blues units to be hidden |
void |
hideRed()
This Method sets all of reds units to be hidden |
void |
killUnit()
This Method destroys the selected unit as though it were destroyed in battle |
void |
moveSelectedPiece(int row,
int column)
This Method checks if the selected piece could move to the given square |
void |
newGame()
This Method Starts a new game of Stratego, clearing out the board and switching to placement mode, resetting both UnitsToPlace vectors |
void |
paintComponent(java.awt.Graphics g)
This Method draws the grid lines on the background image |
void |
passTurn()
This Method switches players turns. |
void |
placeUnitInSelectedSquare()
This Method prompts the user for which unit to place in the selected square placing and removing it from the UnitsToPlace Vector it if possible, notifying the user why not otherwise |
void |
playGame()
This Method starts the main Gameplay loop, waiting on input from the current player, and switching turns after. |
void |
removeplaceUnitFromSelectedSquare()
This Method removes the unit from the selected square, returning it to the UnitsToPlace Vector |
void |
resetSelecetedPiece()
This Method sets the selected piece to null and the former row and columns to -1 |
void |
returnSelecetedPiece()
This Method return the selected piece from whence it came |
void |
selectSquare(int x,
int y)
This Method sets the square at the x and y coords as the selected square |
void |
setGameState(int newState)
This Method sets the game state |
void |
setSelectedPiece(StrategoPiece piece,
int row,
int column)
This Method makes the given piece the selected one, and saves its former row and column |
void |
showBlue()
This Method sets all of blues units to be visible |
void |
showRed()
This Method sets all of reds units to be visible |
void |
updateSelectedPiece(int x,
int y)
This Method redraws the selected Piece |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoardManager()
Method Detail |
---|
public int calculateX(int column)
column
- the column to calculate the starting X value of
public int calculateY(int row)
row
- the row to calculate the starting Y value of
public int calculateRow(int Y)
Y
- the Y value to calculate the row from
public int calculateColumn(int X)
X
- the X value to calculate the column value of
public void setSelectedPiece(StrategoPiece piece, int row, int column)
piece
- the StrategoPiece being selectedrow
- the row the piece is incolumn
- the column the piece is inpublic void resetSelecetedPiece()
public void updateSelectedPiece(int x, int y)
x
- the new X valuey
- the new Y valuepublic void returnSelecetedPiece()
public void moveSelectedPiece(int row, int column)
row
- the row to move tocolumn
- the new column to move topublic void paintComponent(java.awt.Graphics g)
g
- the background image in Graphics formatpublic int getGameState()
public void setGameState(int newState)
newState
- the game state to change topublic StrategoBoard getStrategoBoard()
public StrategoPiece getSelectedPiece()
public void drawBoard()
public void deityMode()
public void flagReveal()
public void killUnit()
public void selectSquare(int x, int y)
x
- the x coordinatey
- the y coordinatepublic void placeUnitInSelectedSquare()
public void removeplaceUnitFromSelectedSquare()
public void newGame()
public void playGame()
public void passTurn()
public void hideRed()
public void hideBlue()
public void showRed()
public void showBlue()
public boolean canRedMove()
public boolean canBlueMove()
public void gameOver()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |