Class GridCell
Cell that composes the BattleGrid and Bench, and that allows the movement and battle of characters.
Namespace: AutoBattleFramework.Battlefield
Assembly: cs.temp.dll.dll
Syntax
public class GridCell : MonoBehaviour
Fields
CanPlaceCharacter
Index of the player who can place characters on this cell. Used to prevent characters from different teams from occupying cells belonging to other teams.
Declaration
public int CanPlaceCharacter
Field Value
Type | Description |
---|---|
Int32 |
distancesToOtherCells
Distance from this cell to the rest of the cells in the grid.
Declaration
public int[] distancesToOtherCells
Field Value
Type | Description |
---|---|
Int32[] |
grid
Reference to the grid where the cell is located.
Declaration
public BattleGrid grid
Field Value
Type | Description |
---|---|
BattleGrid |
Neighbors
Cell neighbors. If the cell type is hexagonal, it will have up to 6 neighbors, if it is square, it will have up to 4 neighbors.
Declaration
public List<GridCell> Neighbors
Field Value
Type | Description |
---|---|
List<GridCell> |
shopItem
The GameCharacter or GameItem that is occupying the cell.
Declaration
public GameActor shopItem
Field Value
Type | Description |
---|---|
GameActor |
Methods
DistanceToOtherCell(GridCell)
Get the cell distance between this cell and other.
Declaration
public int DistanceToOtherCell(GridCell cell)
Parameters
Type | Name | Description |
---|---|---|
GridCell | cell | Cell in the grid |
Returns
Type | Description |
---|---|
Int32 | Distance between both cells. |
FindNearestGridCell(Single, GridCell, GameCharacter)
Given another cell and the character occupying it, find the nearest unoccupied cell within the radius. If the cell passed as a parameter is within the radius and is occupied by the character, it returns that one instead.
Declaration
public GridCell FindNearestGridCell(float radius, GridCell other, GameCharacter character)
Parameters
Type | Name | Description |
---|---|---|
Single | radius | Radius where to look for the nearest cell. |
GridCell | other | Another cell occupied by the character. |
GameCharacter | character | Character that occupies the cell passed as parameter. |
Returns
Type | Description |
---|---|
GridCell | Cell closest to this one within the radius. If the parameter cell is within the radius and is occupied by the parameter character, it returns that one instead. |
SetDragEffect(Boolean)
Sets the value of the drag effect.
Declaration
public void SetDragEffect(bool value)
Parameters
Type | Name | Description |
---|---|---|
Boolean | value | If should change the color of the cell to DragOver. |