Class BattleGrid
It allows the movement of characters through the cells that compose it. The Custom Inspector allows to create a grid quickly.
Namespace: AutoBattleFramework.Battlefield
Assembly: cs.temp.dll.dll
Syntax
public class BattleGrid : MonoBehaviour
Fields
CellScale
When GridSquared or GridHex are instantiated, its X and Z local scale will be multiplied by this value.
Declaration
public float CellScale
Field Value
Type | Description |
---|---|
Single |
GridCells
Cells that compose the grid.
Declaration
public GridCell[] GridCells
Field Value
Type | Description |
---|---|
GridCell[] |
GridHeight
Number of cells across the width of the grid.
Declaration
public int GridHeight
Field Value
Type | Description |
---|---|
Int32 |
GridHex
Prefab of the cell used if the grid type is Hex.
Declaration
public GridCell GridHex
Field Value
Type | Description |
---|---|
GridCell |
GridShape
Type of grid that will be generated.
Declaration
public BattleGrid.GridType GridShape
Field Value
Type | Description |
---|---|
BattleGrid.GridType |
GridSquared
Prefab of the cell used if the grid type is Squared.
Declaration
public GridCell GridSquared
Field Value
Type | Description |
---|---|
GridCell |
GridWidth
Number of cells across the width of the grid.
Declaration
public int GridWidth
Field Value
Type | Description |
---|---|
Int32 |
RotateCells
If true, rotate the cells 15 degrees if hex, 45 if squared.
Declaration
public bool RotateCells
Field Value
Type | Description |
---|---|
Boolean |
separation
Separation distance between cells.
Declaration
public float separation
Field Value
Type | Description |
---|---|
Single |
Team1Drag
Color of the cell of Team 1 if a character is being dragged over it.
Declaration
public Color Team1Drag
Field Value
Type | Description |
---|---|
Color |
Team1EmptyCell
Color of the cell of Team 1 if it is empty.
Declaration
public Color Team1EmptyCell
Field Value
Type | Description |
---|---|
Color |
Team1OccupiedCell
Color of the cell of Team 1 if a character is on it.
Declaration
public Color Team1OccupiedCell
Field Value
Type | Description |
---|---|
Color |
Team1RowNumber
Number of rows assigned to team 1. The rest will be assigned to group 2.
Declaration
public int Team1RowNumber
Field Value
Type | Description |
---|---|
Int32 |
Team2Drag
Colo of the cell of Team 2 if a character is being dragged over it.
Declaration
public Color Team2Drag
Field Value
Type | Description |
---|---|
Color |
Team2EmptyCell
Color of the cell of Team 2 if it is empty.
Declaration
public Color Team2EmptyCell
Field Value
Type | Description |
---|---|
Color |
Team2OccupiedCell
Color of the cell of Team 2 if a character is on it.
Declaration
public Color Team2OccupiedCell
Field Value
Type | Description |
---|---|
Color |
Methods
CalculateDistances()
Pre-calculates the distances of all cells from each other.
Declaration
public void CalculateDistances()
FindHexNeighbors()
Find the neighbors of each cell in a hexagonal grid.
Declaration
public void FindHexNeighbors()
FindSquaredNeighbors()
Find the neighbors of each cell in a squared grid.
Declaration
public void FindSquaredNeighbors()
ShowCells(Boolean)
Show or hide the sprites of the cells.
Declaration
public void ShowCells(bool show)
Parameters
Type | Name | Description |
---|---|---|
Boolean | show | Show or hide the cells. |
SpawnGridEditor()
Method used by the custom inspector to create a grid quickly.
Declaration
public void SpawnGridEditor()
UpdateColors()
Update the colors of the grid
Declaration
public void UpdateColors()