The script attached to the chessboard prefab, should have gameobjects with squarescripts, this class: verifies if the player can drag and drop pieces, handles whether or not the engine should make move, checks whether or not the game is over(and if so shows the game over prefab), flips the board, resets the board etc.
More...
Inherits MonoBehaviour.
|
enum | BoardMode {
Undefined,
PlayerVsPlayer,
PlayerVsEngine,
EngineVsPlayer,
EngineVsEngine
} |
| All possible board modes. More...
|
|
|
void | start (cgBoard customBoard=null, BoardMode mode=BoardMode.Undefined) |
| Start the game, with provided board. More...
|
|
cgSquareScript [] | getSquares () |
| Get all cgSquareScripts. More...
|
|
void | placePieces () |
| Place pieces according to the current state of the underlying abstractboard. More...
|
|
void | ResetBoard () |
| Resets the board, called by the menu button called restart. More...
|
|
void | RevertLastMove () |
| Reverts the last move, called by the menu button called revert last move. More...
|
|
void | MainMenu () |
| Instantiates and shows an instance of MainMenuPrefab. Called by menu button called Main Menu More...
|
|
void | FlipBoard () |
| Flips the board so if white is currently on top, it will be at the bottom. Preferable if playing as black. Called by the menu button called Flip Board. More...
|
|
void | SuggestMove () |
| Use the engine to find a suggested move for the current position. Called by the menu button called Suggest Move. More...
|
|
void | playSound (AudioClip clip) |
| Play provided sound, adds an audiosource if one does not exist on this gameobject. More...
|
|
void | MakeEngineMove (cgBoard board, bool MoveAsWhiteP, Action< List< cgSimpleMove >> callback) |
| Called when the engine should generate a new move. More...
|
|
void | setBoardTo (cgBoard board) |
| Set the board to the provided abstract board, write any moves provided in said abstract board to the log, etc. More...
|
|
The script attached to the chessboard prefab, should have gameobjects with squarescripts, this class: verifies if the player can drag and drop pieces, handles whether or not the engine should make move, checks whether or not the game is over(and if so shows the game over prefab), flips the board, resets the board etc.
◆ BoardMode
All possible board modes.
◆ FlipBoard()
void cgChessBoardScript.FlipBoard |
( |
| ) |
|
Flips the board so if white is currently on top, it will be at the bottom. Preferable if playing as black. Called by the menu button called Flip Board.
◆ getSquares()
Get all cgSquareScripts.
- Returns
- All cgSquareScripts
◆ MainMenu()
void cgChessBoardScript.MainMenu |
( |
| ) |
|
Instantiates and shows an instance of MainMenuPrefab. Called by menu button called Main Menu
◆ MakeEngineMove()
void cgChessBoardScript.MakeEngineMove |
( |
cgBoard |
board, |
|
|
bool |
MoveAsWhiteP, |
|
|
Action< List< cgSimpleMove >> |
callback |
|
) |
| |
Called when the engine should generate a new move.
- Parameters
-
board | The current board state. |
MoveAsWhiteP | Move as white(true) or black(false). |
callback | Where the prefered move will be returned. |
◆ placePieces()
void cgChessBoardScript.placePieces |
( |
| ) |
|
Place pieces according to the current state of the underlying abstractboard.
◆ playSound()
void cgChessBoardScript.playSound |
( |
AudioClip |
clip | ) |
|
Play provided sound, adds an audiosource if one does not exist on this gameobject.
- Parameters
-
◆ ResetBoard()
void cgChessBoardScript.ResetBoard |
( |
| ) |
|
Resets the board, called by the menu button called restart.
◆ RevertLastMove()
void cgChessBoardScript.RevertLastMove |
( |
| ) |
|
Reverts the last move, called by the menu button called revert last move.
◆ setBoardTo()
void cgChessBoardScript.setBoardTo |
( |
cgBoard |
board | ) |
|
Set the board to the provided abstract board, write any moves provided in said abstract board to the log, etc.
- Parameters
-
◆ start()
void cgChessBoardScript.start |
( |
cgBoard |
customBoard = null , |
|
|
BoardMode |
mode = BoardMode.Undefined |
|
) |
| |
Start the game, with provided board.
- Parameters
-
customBoard | The abstract board that we should match, if none specified we use existing one, if none exists we generate an 8x8 board |
mode | Which mode the game is in, player vs player, player vs engine, engine vs engine etc. |
◆ SuggestMove()
void cgChessBoardScript.SuggestMove |
( |
| ) |
|
Use the engine to find a suggested move for the current position. Called by the menu button called Suggest Move.
◆ blackDeadPiecesLocation
Vector3 cgChessBoardScript.blackDeadPiecesLocation = new Vector3(4, -2, 0) |
What location should dead black pieces be placed at?
◆ checkSound
AudioClip cgChessBoardScript.checkSound |
A sound to play when any player makes a move that checks the king.
◆ chessPieceHolder
GameObject cgChessBoardScript.chessPieceHolder |
The target to flip when the user click the Flip board button.
◆ ChessPiecePrefab
GameObject cgChessBoardScript.ChessPiecePrefab |
Main menu prefab, instantiated when the user clicks Main menu button.
◆ chessSquareHolder
GameObject cgChessBoardScript.chessSquareHolder |
The target to flip when the user click the Flip board button.
◆ displayAs3d
bool cgChessBoardScript.displayAs3d = true |
Should the pieces be displayed as 3d pieces?
◆ engineProgressBar
GameObject cgChessBoardScript.engineProgressBar |
The provided loadbar to display how far the analysis is.
◆ flipTarget
GameObject cgChessBoardScript.flipTarget |
The target to flip when the user click the Flip board button.
◆ GameOverPrefab
GameObject cgChessBoardScript.GameOverPrefab |
Game over prefab, instantiated when the game is won/drawn/lost
◆ highlightLastMove
bool cgChessBoardScript.highlightLastMove = true |
Should the last move be highlighted on the board?
◆ highlightLegalMoves
bool cgChessBoardScript.highlightLegalMoves = true |
Should the all legal moves be highlighted when the player drags a piece?
◆ loseSound
AudioClip cgChessBoardScript.loseSound |
A sound to play when the game is lost or drawn.
◆ MainMenuPrefab
GameObject cgChessBoardScript.MainMenuPrefab |
Main menu prefab, instantiated when the user clicks Main menu button.
◆ Mode
BoardMode cgChessBoardScript.Mode = BoardMode.PlayerVsEngine |
◆ moveLog
GUIText cgChessBoardScript.moveLog |
The textfield to log all moves made.
◆ movesMade
int cgChessBoardScript.movesMade = 0 |
The number of moves made.
◆ moveSound
AudioClip cgChessBoardScript.moveSound |
A sound to play whenever a move is made.
◆ NotationType
Which notationtype should be used to notate the game?
◆ randomizeEarlyEngineMoves
bool cgChessBoardScript.randomizeEarlyEngineMoves = true |
Should the early moves of the engine be randomized slightly to allow for a wide array of variations?
◆ searchDepthStrong
byte cgChessBoardScript.searchDepthStrong = 4 |
What depth should the engine search seemingly strong moves to? The higher the value the better the AI and the longer the load time.
◆ searchDepthWeak
byte cgChessBoardScript.searchDepthWeak = 4 |
What depth should the engine search seemingly weak moves to? The higher the value the better the AI and the longer the load time.
◆ startOnLoad
bool cgChessBoardScript.startOnLoad = true |
Should the board start on load, or do you want to manually start the board by called Start?
◆ whiteDeadPiecesLocation
Vector3 cgChessBoardScript.whiteDeadPiecesLocation = new Vector3(3, -2, 0) |
What location should dead white pieces be placed at?
◆ whiteTurnToMove
bool cgChessBoardScript.whiteTurnToMove = true |
Is it whites turn to move? if false then its blacks turn.
◆ winSound
AudioClip cgChessBoardScript.winSound |
A sound to play when the game is won.
◆ getEngine
◆ playerCanMove
bool cgChessBoardScript.playerCanMove |
|
get |
Can the player drag and move pieces? Yes if a human controls the current color whoms turn it is to move.
The documentation for this class was generated from the following file:
- code/scripts/cgChessBoardScript.cs