C# Class BVG.Board

Inheritance: UnityEngine.MonoBehaviour
Mostrar archivo Open project: BigVikingGames/checkers-starter Class Usage Examples

Public Properties

Property Type Description
BOARD_GRID_SIZE int
blackPiecePrefab UnityEngine.GameObject
blackSquarePrefab UnityEngine.GameObject
redPiecePrefab UnityEngine.GameObject
whiteSquarePrefab UnityEngine.GameObject

Public Methods

Method Description
AddPlayerToken ( bool isRed, IntVector2 boardPosition ) : void

Adds a player token of a given colour to the given coordinates.

BoardClicked ( IntVector2 boardPosition ) : void

Callback for a tile getting clicked.

GetBoardState ( IntVector2 boardPosition ) : BoardState

Get the state of the board at a given coordinate.

MovePlayerToken ( ) : void

TODO: Implement for moving a player token. Note: The API can be changed, you can add functions, parameters, properties, whatever.

Private Methods

Method Description
Awake ( ) : void
GetDirectionForIntVector ( IntVector2 vec ) : MoveDirection

Gets the equivalent MoveDirection for an IntVector2.

InstantiateSquare ( GameObject squarePrefab, IntVector2 boardPosition ) : void

Instantiate a given square prefab with the given coordinates. Set all the right properties and add it to the board.

IsValidBoardPosition ( IntVector2 boardPosition ) : bool

Determines whether this instance is valid board position the specified boardPosition.

Method Details

AddPlayerToken() public method

Adds a player token of a given colour to the given coordinates.
public AddPlayerToken ( bool isRed, IntVector2 boardPosition ) : void
isRed bool If set to true is red.
boardPosition IntVector2 The position on the board to add a player token to.
return void

BoardClicked() public method

Callback for a tile getting clicked.
public BoardClicked ( IntVector2 boardPosition ) : void
boardPosition IntVector2 The position on the board that was clicked.
return void

GetBoardState() public method

Get the state of the board at a given coordinate.
public GetBoardState ( IntVector2 boardPosition ) : BoardState
boardPosition IntVector2 The board position to get the state of.
return BoardState

MovePlayerToken() public method

TODO: Implement for moving a player token. Note: The API can be changed, you can add functions, parameters, properties, whatever.
public MovePlayerToken ( ) : void
return void

Property Details

BOARD_GRID_SIZE public_oe static_oe property

public static int BOARD_GRID_SIZE
return int

blackPiecePrefab public_oe property

public GameObject,UnityEngine blackPiecePrefab
return UnityEngine.GameObject

blackSquarePrefab public_oe property

public GameObject,UnityEngine blackSquarePrefab
return UnityEngine.GameObject

redPiecePrefab public_oe property

public GameObject,UnityEngine redPiecePrefab
return UnityEngine.GameObject

whiteSquarePrefab public_oe property

public GameObject,UnityEngine whiteSquarePrefab
return UnityEngine.GameObject