Deprecated APIs & Migration

advanced scripting

Terrain Grid System 2 · Scripting Support (C#)

Note: This is an exhaustive index of public members for this API area. Signatures may vary by version; rely on your IDE/autocomplete and the source if needed.

API Reference

Deprecated Properties

bool adjustCanvasSize

Adjust canvas size.

bool allowHighlightWhileDragging

Allow highlight while dragging.

string animationSortingLayer

Sets the sorting layer for the animation effects such as fade out

int animationSortingOrder

Sets the sorting order for the animation effects such as fade out

TGSConfigAttribPair[] attribData

Attrib data.

Vector2 betterCentroid

Better centroid.

LayerMask blockingMask

Used to cancel highlighting then some other objects block raycasting (Review: verify this description matches current behavior.)

bool[] blocksLOS

Used by specify if LOS is blocked across cell sides.

Bounds bounds

Bounds.

Bounds bounds

Bounds.

Rectangle bounds

Bounds.

Bounds bounds

Returns current bounds of grid in world space

Camera cameraMain

The camera reference used in certain computations

bool canCross

If this cell blocks path finding.

bool canCross

Can cross.

Rect canvasRect

Canvas rect.

Texture2D canvasTexture

Canvas texture.

bool cellAlphaClipping

Enables/disables alpha clipping (Review: verify this description matches current behavior.)

float cellAlphaTestThreshold

Sets/get cell alpha clipping threshold

float cellBorderAlpha

Cell border alpha.

Color cellBorderColor

Cells border color

float cellBorderThickness

Cells border thickness

int cellCount

Returns the actual number of cells created according to the current grid topology

bool cellCustomBorderThickness

Enables cells custom border thickness

float cellFillPadding

Padding applied to cell fill with color/texture

Color cellHighlightBorderColor

Color for the highlight border (Review: verify this description matches current behavior.)

float cellHighlightBorderSize

Width of the highlight border (only box grids) (Review: verify this description matches current behavior.)

Color cellHighlightColor

Fill color to use when the mouse hovers a cell's region.

Color cellHighlightColor2

Alternate fill color to use when the mouse hovers a cell's region.

Cell cellHighlighted

Returns Cell under mouse position or null if none.

int cellHighlightedIndex

Returns current highlighted cell index.

bool cellHighlightNonVisible

Gets or sets whether invisible cells should also be highlighted when pointer is over them

bool cellHighlightUseCellColor

Instead of using the highlight color, use the cell color if it's set

int cellIndex

Cell index.

int cellIndex

Cell index.

int cellLastClickedIndex

Returns Cell index which has been clicked

List<Cell> cells

Cells in this region.

List<Cell> cells

Cells.

VoronoiCell[] cells

Cells.

List<Cell> cells

Complete array of states and cells and the territory name they belong to.

TGSConfigEntry[] cellSettings

Cell settings.

bool cellsFlat

Gets or sets if cells are rendered as horizontal flat surfaces ignoring any terrain slope.

Vector2 cellSize

Gets current individual cell size or sets user defined cell size

float cellsMaxHeightDifference

Gets or sets the cells max height different between vertices. Cells with a greater difference than this threshold will be hidden.

float cellsMaximumAltitude

Gets or sets the maximum cell altitude. Useful to hide cells above certain altitude.

bool cellsMaximumAltitudeClampVertices

Clamps vertices above the maximum altitude (Review: verify this description matches current behavior.)

float cellsMaxSlope

Gets or sets the cells max slope. Cells with a greater slope will be hidden.

float cellsMinimumAltitude

Gets or sets the minimum cell altitude. Useful to hide cells under certain altitude, for instance, under water.

bool cellsMinimumAltitudeClampVertices

Clamps vertices below the minimum altitude (Review: verify this description matches current behavior.)

CELL_TEXTURE_MODE cellTextureMode

Returns the cells texture mode. Usually texturing is done inside the cell shape or using a quad floating on top of the cell.

CELL_TILE_BACKGROUND_MODE cellTileBackgroundMode

Returns the cells texture transparent mode when rendering in "Floating" mode.

Vector2 cellTileOffset

Returns the default scale for cell tiles

Vector2 cellTileScale

Returns the default scale for cell tiles

Vector2 centroid

Centroid.

Point centroid

Centroid.

List<Renderer> childrenSurfaces

If the gameobject contains one or more children surfaces with name splitSurface due to having +65000 vertices

float circularFadeDistance

Circular fade distance.

bool circularFadeEnabled

When enabled, grid is faded out according to distance to a gameoject

float circularFadeFallOff

Circular fade fall off.

Transform circularFadeTarget

The gameobject reference for the circular fade out effect

byte clearance

Distance to nearest blocking cell

Color color

Color.

Color color

Color.

ushort row, column

Column.

int column

Column.

int columnCount

Returns the number of columns for box and hexagonal grid topologies

string config

Config.

coordinates

Description not found in source.

float cornerJitter

Corner jitter.

float[] crossCost

Used by pathfinding in Cell mode. Cost for crossing a cell for each side. Defaults to 1.

float crossCost; // all sides public float[] crossSidesCost; // per side public Vector2 textureScale, textureOffset

Cross cost.

GameObject customBorderGameObject

Reference to a custom border drawn using CellDrawBorder or TerritoryDrawFrontier

GameObject customFrontiersGameObject

The reference to custom territory borders if drawn (not interior; interior borders are stored in each region)

bool customIsCanvasTexture

Custom is canvas texture.

bool customized

Customized.

Material customMaterial

Custom material.

bool customRotateInLocalSpace

Custom rotate in local space.

customTextureOffset

Description not found in source.

float customTextureRotation

Custom texture rotation.

bool disableMeshGeneration

Disable mesh generation.

CellDebugInfo displayCellDebugInfo

Shows cell information over the grid in Scene View

TerritoryDebugInfo displayTerritoryDebugInfo

Shows territory information over the grid in Scene View

bool enableGridEditor

Enabled grid editing options in Scene View

bool enableRectangleSelection

Enable rectangle selection.

IAdmin entity

Entity.

bool evenLayout

Toggle even corner in hexagonal topology.

float farFadeDistance

Far fade distance.

bool farFadeEnabled

When enabled, lines far the camera will fade out gracefully

float farFadeFallOff

Far fade fall off.

Color fillColor

Fill color.

string filterTerritories

Filter territories.

frontierColor

Description not found in source.

float gridCameraOffset

Grid camera offset.

Vector2 gridCenter

Center of the grid relative to the Terrain (by default, 0,0, which means center of terrain)

Vector3 gridCenterWorldPosition

Center of the grid in world space coordinates. You can also use this property to reposition the grid on a given world position coordinate.

float gridCurvature

Gets or sets the grid's curvature factor.

int gridDepthOffset

Grid depth offset.

Obsolete: Use gridMeshDepthOffset or gridSurfaceDepthOffset.

float gridElevation

Grid elevation.

float gridElevationBase

Grid elevation base.

float gridElevationCurrent

Grid elevation current.

Texture2D gridMask

Gets or sets the grid mask. The alpha component of this texture is used to determine cells visibility (0 = cell invisible)

int gridMaskInsideCount

Minimum number of vertices that must be inside the grid mask to consider the entire cell is inside the mask

bool gridMaskUseScale

When set to true, the mask will be mapped onto the scaled grid rectangle (using offset and scale parameters) instead of the full quad which ignores the offset and scale

int gridMeshDepthOffset

Grid mesh depth offset.

float gridMinElevationMultiplier

Grid min elevation multiplier.

float gridNormalOffset

Grid normal offset.

int gridRelaxation

Sets the relaxation iterations used to normalize cells sizes in irregular topology. (Review: verify this description matches current behavior.)

float gridRoughness

Grid roughness.

Vector2 gridScale

Scale of the grid on the Terrain (by default, 1,1, which means occupy entire terrain)

int gridSurfaceDepthOffset

Grid surface depth offset.

int gridSurfaceDepthOffsetTerritory

Grid surface depth offset territory.

GridTopology gridTopology

The grid type (boxed, hexagonal or irregular)

int group

Group for this cell. A different group can be assigned to use along with FindPath cellGroupMask argument.

int heightmapHeight

Heightmap height.

int heightmapHeight

Heightmap height.

int heightmapHeight

Heightmap height.

int heightmapWidth

Heightmap width.

int heightmapWidth

Heightmap width.

int heightmapWidth

Heightmap width.

GameObject highlightedObj

Returns a reference of the currently highlighted gameobject (cell or territory)

HighlightEffect highlightEffect

Highlight effect.

float highlightFadeAmount

Highlight fade amount.

float highlightFadeMin

Highlight fade min.

float highlightFadeSpeed

Highlight fade speed.

Texture2D highlightMask

Highlight mask.

float highlightMinimumTerrainDistance

Minimum distance from camera for cells to be highlighted on terrain

HighlightMode highlightMode

Highlight mode.

float highlightScaleMax

Highlight scale max.

float highlightScaleMin

Highlight scale min.

int index

The index of the cell in the cells array

IInputProxy input

Access to the input class

TerrainGridSystem instance

Instance.

GameObject interiorBorderGameObject

Reference to a custom border drawn using TerritoryDrawInteriorBorder

bool isEmpty

Is empty.

bool isFlat

Determines if this region should be rendered flat to the terrain

int iteration

Used internally to optimize certain algorithms

string key

Key.

Vector3 localCursorLastClickedPosition

Returns the position of the last click on the grid (in local coordinates. Use transform.TransformPoint(x) to convert to world space)

Vector3 localCursorPosition

Returns the current cursor position in grid local coordinates (use transform.TransformPoint(x) to convert to world space)

bool multiTerrain

Multi terrain.

string name

Optional territory name.

float nearClipFade

Near clip fade.

bool nearClipFadeEnabled

When enabled, lines near the camera will fade out gracefully

float nearClipFadeFallOff

Near clip fade fall off.

List<Cell> neighbors

Cells adjacent to this cell

List<Territory> neighbors

List of other territories sharing some border with this territory

bool neutral

A neutral territory doesn't show conflicting borders with adjacent territories

int numCells

Gets or sets the desired number of cells in irregular topology.

float numericValue

Numeric value.

int numTerritories

Gets or sets the number of initial territories.

OverlayMode overlayMode

Overlay mode.

float pathFindingHeavyDiagonalsCost

The cost for crossing diagonals. (Review: verify this description matches current behavior.)

PathFinding.HeuristicFormula pathFindingHeuristicFormula

The path finding heuristic formula to estimate distance from current position to destination

bool pathFindingIncludeInvisibleCells

If true, the path will include invisible cells as well.

float pathFindingMaxCost

The maximum search cost of the path finding execution.

int pathFindingMaxSteps

The maximum number of steps that a path can return.

bool pathFindingUseDiagonals

If path can include diagonals between cells

List<Vector2> points

Points coordinates with applied grid offset and scale

List<Point> points

Points.

bool pointyTopHexagons

Pointy top hexagons.

Polygon polygon

Polygon.

Rect rect2D

Scaled rect (rect with grid offset and scale applied)

float rect2DArea

Rect d area.

double rect2DArea

Rect d area.

Region region

Physical surface-related data

List<Region> regions

List of physical regions. Usually territories have only one region, but they can be split by assigning cells to other territories

bool regularHexagons

Regular hexagons.

float regularHexagonsWidth

Regular hexagons width.

Renderer renderer

Renderer.

MeshRenderer renderer

Renderer.

int renderingOrder

Used internally to ensure smaller territory surfaces are rendered before others

bool respectOtherUI

When enabled, will prevent interaction if pointer is over an UI element

int rowCount

Returns the number of rows for box and hexagonal grid topologies

Vector3 screenCursorLastClickedPosition

Returns the screen position of the last click

int seed

Randomize seed used to generate territories. For Box/Hexagonal grids, changing seed only affects territory distribution. For Irregular grids, seed also affects cell positions unless voronoiSites are user-defined or Voronoi data is baked.

List<Segment> segments

Original grid segments. Segments coordinates are not scaled.

List <Segment> segments

Segments.

int sortIndex

Used internally to keep territory regions list order during updates

int sortingOrder

Sets the sorting layer for the grid elements (only valid when rendering in transparent queue)

bool storeCellIndices

Store cell indices.

string stringValue

String value.

GameObject surfaceGameObject

Surface game object.

int tag

Optional value that can be set with CellSetTag. You can later get the cell quickly using CellGetWithTag method.

int tag

Tag.

Terrain terrain

Terrain.

ITerrainWrapper terrain

Terrain.

Vector3 terrainCenter

Returns the terrain center in world space.

Vector2 terrainMeshPivot

Terrain mesh pivot.

GameObject terrainObject

Terrain reference. Assign a terrain to this property to fit the grid to terrain height and dimensions

LayerMask terrainObjectsLayerMask

Terrain objects layer mask.

string terrainObjectsPrefix

Terrain objects prefix.

bool terrainObjectsSearchGlobal

Terrain objects search global.

List<Territory> territories

Territories.

float territoriesAsymmetry

Determines the distribution of cells among territories

TerritoryColorScheme territoriesColorScheme

How colors for territories are picked

int territoriesColorSeed

Seed used to generate random territory fill colors.

Color[] territoriesFillColors

User defined territory colors

bool territoriesHideNeutralCells

Gets or sets if neutral cells are visible.

bool territoriesIgnoreHiddenCells

Set this property to true to allow territories to be surrounded by other territories.

int[] territoriesInitialCellIndices

Gets or sets the cell indices for the first cells of territories during generation.

TerritoryInitialCellMethod territoriesInitialCellMethod

Gets or sets the number of initial territories.

int territoriesMaxIterations

Maximum number of iterations when generation territories

int territoriesMaxRange

Maximum distance in cell units from the origin cell when generating territories. 0 = only origin cells.

float territoriesOrganic

Makes territory contour more organic

Texture2D territoriesTexture

Territories texture.

Color territoriesTextureNeutralColor

Territories texture neutral color.

bool territoryCustomBorderThickness

Enables territory custom border thickness

Color territoryDisputedFrontierColor

Territories disputed borders color

float territoryFrontiersAlpha

Territory frontiers alpha.

Color territoryFrontiersColor

Territories border color

bool territoryFrontiersMiterJoins

Uses miter joins for territory frontier thick lines (avoids gaps/overlaps at corners when geometry shaders are not used)

float territoryFrontiersThickness

Territory frontier thickness

Color territoryHighlightColor

Fill color to use when the mouse hovers a territory's region.

Color territoryHighlightColor2

Alternate fill color to use when the mouse hovers a territory's region.

Territory territoryHighlighted

Returns Territory under mouse position or null if none.

int territoryHighlightedIndex

Returns currently highlighted territory index in the countries list.

int territoryHighlightedRegionIndex

Returns currently highlighted territory region index.

short territoryIndex

The territory to which this cell belongs to. You can change it using CellSetTerritory method. WARNING: do not change this value directly, use CellSetTerritory instead.

int territoryIndex

Territory index.

int territoryIndex

Territory index.

int territoryIndex

Territory index.

bool territoryInteriorBorderIncludeEnclaves

Show interior borders on top of regular territory borders.

bool territoryInteriorBorderOnTop

Show interior borders on top of regular territory borders.

float territoryInteriorBorderPadding

Territory interior border padding

float territoryInteriorBorderThickness

Territory interior border thickness

int territoryLastClickedIndex

Returns Territory index which has been clicked

int territoryRegionLastClickedIndex

Returns Territory region index which has been clicked

int textureIndex

Texture index.

textureOffset

Description not found in source.

Texture2D[] textures

Textures.

Texture2D[] textures

Textures.

string title

Title.

bool transparentBackground

When enabled, grid is visible without background mesh

int usedFlag, usedFlag2

Used for performance optimizations.

bool useGeometryShaders

When enabled, geometry shaders will be used (if platform supports them)

bool useStencilBuffer

When enabled, stencil buffer will be used to avoid overdraw and ensure correct rendering order of grid features. You can disable this option if it creates conflicts with other stencil-based renderers.

bool visible

Visible.

bool visible

Returns the actual visibility state of the cell. The setter will set only visibleSelf and not visibleByRules or visibleAlways.

bool visible

Visible.

bool visibleAlways

Gets or sets whether the cell is always visible, regardless of other rules.

bool visibleAlways

Visible always.

bool visibleByRules

Gets or sets the visibility of the cell based on rules.

bool visibleSelf

Gets or sets whether the cell is visible. If true, the cell will be visible if visibleByRules is also visible. Use "visible" to determine the actual visibility state.

byte[] voronoiSerializationData

Gets baked Voronoi cells

List<Vector2> voronoiSites

Sets or gets a list of Voronoi sites. Full list will be completed with random number up to numCells amount.

partial class Cell : AdminEntity
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class TerrainGridSystem : MonoBehavior
partial class Territory: AdminEntity
bool isEmpty

Returns true if thi territory has no regions

gridDepthOffset

Source: `/Users/ramcor/Documents/TerrainGridSystem/TerrainGridSystem/Assets/TerrainGridSystem/Scripts/TerrainGridSystem.cs`:967

Deprecated Cell Methods

event CellClickEvent OnCellClick(TerrainGridSystem tgs, int cellIndex, int buttonIndex)

Occurs when user releases the mouse button on the same cell that started clicking

event CellDragEvent OnCellDrag(TerrainGridSystem tgs, int cellOriginIndex, int cellTargetIndex)

Occurs when user drags a cell

event CellDragEvent OnCellDragEnd(TerrainGridSystem tgs, int cellOriginIndex, int cellTargetIndex)

Occurs when user ends drag on a cell

event CellEvent OnCellDragStart(TerrainGridSystem tgs, int cellIndex)

Occurs when user starts dragging on a cell

event CellEvent OnCellEnter(TerrainGridSystem tgs, int cellIndex)

Occurs when the pointer enters a cell

event CellEvent OnCellExit(TerrainGridSystem tgs, int cellIndex)

Occurs when the pointer exits a cell

event CellHighlightEvent OnCellHighlight(TerrainGridSystem tgs, int cellIndex, ref bool cancelHighlight)

Occurs when a cell is about to get highlighted

event CellClickEvent OnCellMouseDown(TerrainGridSystem tgs, int cellIndex, int buttonIndex)

Occurs when user presses the mouse button on a cell

event CellClickEvent OnCellMouseUp(TerrainGridSystem tgs, int cellIndex, int buttonIndex)

Occurs when user releases the mouse button on any cell

Cell(Vector2 center)

Performs cell.

Cell()

Performs cell.

GameObject CellAddSprite(int cellIndex, Sprite sprite, bool adjustScale = true)

Creates a gameobject with SpriteRenderer and places it on top of the cell

void CellBlink(Cell cell, Color color1, Color color2, float duration = 2f, int repetitions = 1)

Blinks a cell with colors "color1" and "color2" and "duration" in seconds.

void CellBlink(int cellIndex, Color color1, Color color2, float duration = 2f, int repetitions = 1)

Blinks a cell with colors "color1" and "color2" and "duration" in seconds.

void CellBlink(List<int> cellIndices, Color color1, Color color2, float duration = 2f, int repetitions = 1)

Blinks a list of cells with colors "color1" and "color2" and "duration" in seconds.

void CellBlink(List<Cell> cells, Color color1, Color color2, float duration = 2f, int repetitions = 1)

Blinks a list of cells with colors "color1" and "color2" and "duration" in seconds.

void CellBlink(Cell cell, Color color, float duration = 2f, int repetitions = 1)

Blinks a cell with "color" and "duration" in seconds.

void CellBlink(int cellIndex, Color color, float duration = 2f, int repetitions = 1)

Blinks a cell with "color" and "duration" in seconds.

void CellBlink(List<int> cellIndices, Color color, float duration = 2f, int repetitions = 1)

Blinks a list of cells with "color" and "duration" in seconds.

void CellBlink(List<Cell> cells, Color color, float duration = 2f, int repetitions = 1)

Blinks a list of cells with "color" and "duration" in seconds.

void CellCancelAnimations(int cellIndex, float fadeOutDuration = 0)

Cancels any ongoing visual effect on a cell

void CellCancelAnimations(List<int> cellIndices, float fadeOutDuration = 0)

Cancels any ongoing visual effect on a list of cells

void CellClear(int cellIndex)

Removes any color or texture from a cell and hides it

void CellClear(List<int> cellIndices)

Removes any color or texture from a list of cells and hides them

void CellColorTemp(int cellIndex, Color color, float duration = 2f)

Temporarily colors a cell for "duration" in seconds.

void CellColorTemp(Cell cell, Color color, float duration = 2f, int repetitions = 1)

Temporarily colors a cell for "duration" in seconds.

void CellColorTemp(List<int> cellIndices, Color color, float duration = 2f, int repetitions = 1)

Temporarily colors a list of cells for "duration" in seconds.

void CellColorTemp(List<Cell> cells, Color color, float duration = 2f, int repetitions = 1)

Temporarily colors a list of cells for "duration" in seconds.

void CellDestroyBorder(int cellIndex)

Destroys a custom border previous drawn using CellDrawBorder

void CellDestroySurface(int cellIndex)

Destroys a cell surface and removes it from internal caches

GameObject CellDrawBorder(Cell cell, Color color = default(Color), float thickness = 0, float expand = 1f)

Creates a gameobject with the border for the given cell.

GameObject CellDrawBorder(int cellIndex, Color color = default(Color), float thickness = 0, float expand = 1f)

Creates a gameobject with the border for the given cell.

GameObject CellDrawBorder(List<Cell> cells, Color color = default(Color), float thickness = 1f, float expand = 1f)

Performs cell draw border.

GameObject CellDrawBorder(List<int> cellIndices, Color color = default(Color), float thickness = 1f, float expand = 1f)

Performs cell draw border.

void CellExpandSelection(List<int> cellIndices)

Adds surrounding cells to a list of given cells

void CellFadeOut(Cell cell, Color color, float duration = 2f)

Colors a cell and fades it out for "duration" in seconds.

void CellFadeOut(int cellIndex, Color color, float duration = 2f, int repetitions = 1)

Colors a cell and fades it out during "duration" in seconds.

void CellFadeOut(List<int> cellIndices, Color color, float duration = 2f, int repetitions = 1)

Fades out a list of cells with "color" and "duration" in seconds.

void CellFlash(int cellIndex, Color color, float duration = 2f, int repetitions = 1)

Flashes a cell with "color" and "duration" in seconds.

void CellFlash(Cell cell, Color color, float duration = 2f, int repetitions = 1)

Flashes a cell with "color" and "duration" in seconds.

void CellFlash(List<int> cellIndices, Color color, float duration = 2f, int repetitions = 1)

Flashes a list of cells with "color" and "duration" in seconds.

void CellFlash(List<Cell> cells, Color color, float duration = 2f, int repetitions = 1)

Flashes a list of cells with "color" and "duration" in seconds.

void CellFlash(Cell cell, Color initialColor, Color color, float duration = 2f, int repetitions = 1)

Flashes a cell from "initialColor" to "color" and "duration" in seconds.

void CellFlash(int cellIndex, Color initialColor, Color color, float duration = 2f, int repetitions = 1)

Flashes a cell from "initialColor" to "color" and "duration" in seconds.

void CellFlash(List<int> cellIndices, Color initialColor, Color color, float duration = 2f, int repetitions = 1)

Flashes a list of cells from "initialColor" to "color" and "duration" in seconds.

void CellFlash(List<Cell> cells, Color initialColor, Color color, float duration = 2f, int repetitions = 1)

Flashes a list of cells from "initialColor" to "color" and "duration" in seconds.

void CellGetAdjacents(Vector2 v1, Vector2 v2, out Cell cell1, out Cell cell2)

Returns two adjacent cells that share an edge defined by v1 and v2 in local coordinates

Cell CellGetAtLocalPosition(Vector3 position, int territoryIndex = -1)

Returns the cell object under position in local or worldSpace coordinates

Returns: The get at position.

Cell CellGetAtMousePosition()

Returns the cell at the mouse position

Cell CellGetAtPosition(Vector3 position, bool worldSpace = false, int territoryIndex = -1)

Returns the cell object under position in local or worldSpace coordinates

Obsolete: Use CellGetAtWorldPosition or CellGetAtLocalPosition

Returns: The get at position.

Cell CellGetAtPosition(int column, int row)

Returns the cell located at given row and column

Cell CellGetAtWorldPosition(Vector3 position, int territoryIndex = -1)

Returns the cell object under position in local or worldSpace coordinates

Returns: The get at position.

CellBorderData CellGetBorderData(List<int> cellIndices, float expand = 1f)

Returns the border cells and border vertices for the given cell indices. Similar to CellDrawBorder but returns data instead of drawing.

CellBorderData CellGetBorderData(int cellIndex, float expand = 1f)

Returns the border cells and border vertices for a single cell.

CellBorderData CellGetBorderData(List<Cell> cells, float expand = 1f)

Returns the border cells and border vertices for a list of cells.

Bounds CellGetBounds(int cellIndex)

Returns the rect enclosing the cell in world space. Same than CellGetRectWorldSpace.

int CellGetBoxDistance(int startCellIndex, int endCellIndex)

Returns the number of steps between two cells in box topology. This method does not take into account cell masks or blocking cells. It just returns the distance.

bool CellGetCanCross(int cellIndex)

Returns true if a given cell can be crossed by using the pathfinding engine.

Vector3 CellGetCentroid(int cellIndex, bool worldSpace = true)

Gets the cell's centroid in world space.

Color CellGetColor(int cellIndex)

Returns current cell's fill color

int CellGetColumn(int cellIndex)

Returns cell's column or -1 if cellIndex is not valid.

string CellGetConfigurationData()

Returns a string-packed representation of current cells settings. Each cell separated by ; Individual settings mean: Position Meaning 0 Visibility (0 = invisible, 1 = visible) 1 Territory Index 2 Color R (0..1) 3 Color G (0..1) 4 Color B (0..1) 5 Color A (0..1) 6 Texture Index 7 Cell tag 8 Can cross? (pathfinding)

Obsolete: Use CellGetSettings instead

Returns: The get configuration data.

float CellGetCrossCost(int cellIndex)

Returns the cost of entering or exiting a given hexagonal cell without specifying a specific edge. This method is used along CellSetCrossCost which doesn't take into account per-edge costs.

float CellGetCrossCost(int cellStartIndex, int cellEndIndex)

Returns the cost of going from one cell to another (both cells must be adjacent)

Returns: The get cross cost.

GameObject CellGetExtrudedGameObject(int cellIndex, float extrusionAmount = 1f)

Extrudes the surface of a cell

int CellGetFromGroup(int group, int[] indices, bool useBitWiseComparison = false)

Returns the indices of all cells belonging to a group in the indices array which must be fully allocated when passed. Also the length of this array determines the maximum number of indices returned. This method returns the actual number of indices returned, regardless of the length the array. This design helps reduce heap allocations.

int CellGetFromGroup(int group, List<int> indices, bool useBitWiseComparison = false)

Returns the indices of all cells belonging to a group in the indices array which must be fully allocated when passed. Also the length of this array determines the maximum number of indices returned. This method returns the actual number of indices returned, regardless of the length the array. This design helps reduce heap allocations.

GameObject CellGetGameObject(int cellIndex)

Returns the shape/surface gameobject of the cell.

Returns: The get game object.

int CellGetGroup(int cellIndex)

Returns cell group (default 1)

int CellGetHexagonDistance(int startCellIndex, int endCellIndex)

Returns the hexagon distance between two cells (number of steps to reach end cell from start cell). This method does not take into account cell masks or blocking cells. It just returns the distance.

Returns: The get hexagon distance.

int CellGetInArea(Bounds bounds, List<int> cellIndices, float padding = 0, bool checkAllVertices = false)

Returns the indices of the cells within or under a volume

int CellGetInArea(GameObject gameObject, List<int> cellIndices, float padding = 0, bool checkAllVertices = false)

Returns the indices of the cells within or under a volume

int CellGetInArea(Vector2 localStartPos, Vector2 localEndPos, List<int> cellIndices, float paddingInLocalSpace = 0, bool checkAllVertices = false)

Returns the indices of the cells within or under a volume

int CellGetInArea(BoxCollider boxCollider, List<int> cellIndices, int resolution, float padding = 0, float offset = 0)

Returns the indices of the cells under a box collider

int CellGetIndex(Cell cell)

Returns the index of a cell in the cells array by its reference.

int CellGetIndex(int row, int column, bool clampToBorders = true)

Returns the index of a cell by its row and column numbers.

Returns: The get index.

int CellGetIndex(Vector3 position, bool worldSpace = false)

Returns the cell index of a cell at a given position (in local or world space) in the grid

void CellGetLine(int startCellIndex, int endCellIndex, ref List<int> cellIndices, ref List<Vector3> worldPositions, int lineResolution = 2)

Returns a line composed of cells and world positions from starting cell to ending cell

Returns: true, if there's a straight path of non-blocking cells between the two positionsfalse otherwise.

bool CellGetLineOfSight(Vector3 startPosition, Vector3 endPosition, ref List<int> cellIndices, ref List<Vector3> worldPositions, int cellGroupMask = -1, int lineResolution = 2, bool exhaustiveCheck = false, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool checkLastCell = false)

Traces a line between two positions and check if there's no cell blocking the line

Returns: true, if there's a straight path of non-blocking cells between the two positionsfalse otherwise.

bool CellGetLineOfSight(int startCellIndex, int endCellIndex, ref List<int> cellIndices, ref List<Vector3> worldPositions, int cellGroupMask = -1, int lineResolution = 2, bool exhaustiveCheck = false, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool checkLastCell = false, bool bidirectionalCheck = false)

Traces a line between two positions and check if there's no cell blocking the line

Returns: true, if there's a straight path of non-blocking cells between the two positionsfalse otherwise.

int CellGetNeighbor(int cellIndex, CELL_SIDE side)

Returns the index of an ajacent cell by the side name

List<Cell> CellGetNeighbors(Cell cell)

Returns a list of neighbor cells for specificed cell.

List<Cell> CellGetNeighbors(int cellIndex)

Returns a list of neighbor cells for specificed cell index.

int CellGetNeighbors(int cellIndex, List<Cell> neighbors)

Returns a list of neighbor cells for specificed cell index.

int CellGetNeighbors(int cellIndex, List<int> neighbors)

Returns a list of neighbor cells for specificed cell index.

List<int> CellGetNeighbors(Cell cell, int maxSteps = -1, int cellGroupMask = -1, float maxSearchCost = 0, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, int maxResultsCount = int.MaxValue, bool cellGroupMaskExactComparison = false, CellFilterDelegate filter = null)

Get a list of cells which are nearer than a given distance in cell count

List<int> CellGetNeighbors(int cellIndex, int maxSteps = -1, int cellGroupMask = -1, float maxSearchCost = 0, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, int maxResultsCount = int.MaxValue, bool cellGroupMaskExactComparison = false, CellFilterDelegate filter = null)

Get a list of cells which are nearer than a given distance in cell count

int CellGetNeighbors(int cellIndex, int maxSteps, List<int> cellIndices, int cellGroupMask = -1, float maxSearchCost = 0, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, int maxResultsCount = int.MaxValue, bool ignoreCellCosts = false, bool includeInvisibleCells = true, bool cellGroupMaskExactComparison = false, CellFilterDelegate filter = null)

Get a list of cells which are nearer than a given distance in cell count

List<int> CellGetNeighborsWithinRange(int cellIndex, int minSteps, int maxSteps, int cellGroupMask = -1, float maxCost = -1, bool includeInvisibleCells = true, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool ignoreCellCosts = false, bool cellGroupMaskExactComparison = false, CellFilterDelegate filter = null)

Get a list of cells which are nearer than a given distance in cell count

Vector3 CellGetNormal(int cellIndex)

Returns the normal at the center of a cell

Returns: The normal in world space coordinates.

bool CellGetOverlayMode(int cellIndex)

Returns true if cell is in overlay mode

Vector3 CellGetPosition(int cellIndex, bool worldSpace = true, float elevation = 0)

Gets the cell's center position in world space or local space.

Vector3 CellGetPosition(Cell cell, bool worldSpace = true, float elevation = 0)

Gets the cell's center position in world space or local space.

Rect CellGetRect(int cellIndex)

Returns the rect enclosing the cell in local space coordinates

Bounds CellGetRectWorldSpace(int cellIndex)

Returns the rect enclosing the cell in world space

int CellGetRow(int cellIndex)

Returns cell's row or -1 if cellIndex is not valid.

TGSConfigEntry[] CellGetSettings()

Returns an array with the main settings of each cell.

TGSConfigEntry[] CellGetSettings(bool onlyCustomized)

Performs cell get settings.

bool CellGetSideBlocksLOS(int cellIndex, CELL_SIDE side, CELL_DIRECTION direction = CELL_DIRECTION.Any)

Returns true if the side of a cell blocks LOS.

float CellGetSideCrossCost(int cellIndex, CELL_SIDE side, CELL_DIRECTION direction = CELL_DIRECTION.Any)

Gets the cost of crossing any hexagon side. (Review: verify this description matches current behavior.)

int CellGetTag(int cellIndex)

Returns the tag value of a given cell.

int CellGetTerritoryIndex(int cellIndex)

Returns cell's territory index to which it belongs to, or -1 if error.

int CellGetTerritoryRegionIndex(int cellIndex)

Returns cell's territory region index to which it belongs to, or -1 if error.

Texture2D CellGetTexture(int cellIndex)

Returns current cell's fill texture

int CellGetTextureIndex(int cellIndex)

Returns current cell's fill texture index (if texture exists in textures list). Texture index is from 1..32. It will return 0 if texture does not exist or it does not match any texture in the list of textures.

Vector2 CellGetTextureOffset(int cellIndex)

Returns the offset of the texture of a given cell

Vector2 CellGetTextureScale(int cellIndex)

Returns the scale of the texture of a given cell

int CellGetVertexCount(int cellIndex)

Returns the number of vertices of the cell

Vector3 CellGetVertexPosition(int cellIndex, int vertexIndex)

Returns the world space position of the vertex (Review: verify this description matches current behavior.)

Vector2 CellGetViewportSize(int cellIndex)

Returns the size in normalized viewport coordinates (0..1) for the given cell if that cell was on the center of the screen

Returns: The get rect screen space.

int CellGetWithinCone(int cellIndex, Vector2 direction, float maxDistance, float angle, List<int> cellIndices)

Returns a list of cells contained in a cone defined by a starting cell, a direction, max distance and an angle for the cone

Returns: The number of found cells (-1 if some index is out of range)

int CellGetWithinCone(int cellIndex, int targetCellIndex, float angle, List<int> cellIndices)

Returns a list of cells contained in a cone defined by a starting cell, a target cellIndex, a max distance and an angle for the cone

Returns: The number of found cells (-1 if some index is out of range)

Cell CellGetWithTag(int tag)

Retrieves Cell object with associated tag.

bool CellHasBorderVisible(int cellIndex)

Returns the state of the border visibility after CellSetBorderVisible has been called

void CellHideRegionSurface(int cellIndex)

Uncolorize/hide specified cell by index in the cells collection.

void CellHideRegionSurfaces()

Uncolorize/hide specified all cells.

bool CellIsAdjacentToCell(int cellIndex, int otherCellIndex)

Checks if the given cell is neighbor of another cell

bool CellIsAdjacentToTerritory(int cellIndex, int territoryIndex)

Checks if the given cell is neighbor of the territory

bool CellIsBorder(int cellIndex)

Performs cell is border.

bool CellIsVisible(int cellIndex)

Returns true if cell is visible

bool CellMerge(Cell cell1, Cell cell2)

Merges cell2 into cell1. Cell2 is removed. Only cells which are neighbors can be merged.

void CellRemove(int cellIndex)

Removes a cell from the cells and territories lists. Note that this operation only removes cell structure but does not affect polygons - mostly internally used

void CellRemove(Cell cell)

Removes a cell from the cells and territories lists. Note that this operation only removes cell structure but does not affect polygons - mostly internally used

void CellScaleSurface(int cellIndex, float scale)

Escales the gameobject of a colored/textured surface (Review: verify this description matches current behavior.)

void CellSetBorderVisible(int cellIndex, bool visible)

Specifies if a given cell's border is visible.

void CellSetCanCross(int cellIndex, bool canCross)

Specifies if a given cell can be crossed by using the pathfinding engine.

void CellSetCanCross(List<int> cellIndices, bool canCross)

Specifies if a list of cells can be crossed by using the pathfinding engine.

void CellSetColor(int cellIndex, Color color)

Sets current cell's fill color. Use CellToggleRegionSurface for more options

void CellSetColor(Cell cell, Color color)

Sets current cell's fill color. Use CellToggleRegionSurface for more options

void CellSetColor(List<int> cellIndices, Color color)

Sets cells' fill color.

void CellSetColor(List<Cell> cellIndices, Color color)

Sets cells' fill color.

void CellSetConfigurationData(string cellData, int[] filterTerritories)

Sets cell configuration data from a string

Obsolete: Use CellSetSettings instead

void CellSetCrossCost(int cellIndex, float cost, CELL_DIRECTION direction = CELL_DIRECTION.Entering)

Sets cost of entering or exiting a given hexagonal cell across any edge.

void CellSetCrossCost(int cellStartIndex, int cellEndIndex, float cost)

Sets the cost for going from one cell to another (both cells must be adjacent).

void CellSetGroup(int cellIndex, int group)

Specifies the cell group (by default 1) used by FindPath cellGroupMask optional argument

GameObject CellSetMaterial(int cellIndex, Material material)

Assigns a custom material to a cell

void CellSetOverlayMode(int cellIndex, bool overlayMode)

Sets a cell overlay mode by setting the material

void CellSetSettings(TGSConfigEntry[] cellSettings, int[] filterTerritories, bool entriesHaveIndices = false)

Performs cell set settings.

void CellSetSideBlocksLOS(int cellIndex, CELL_SIDE side, bool blocks, CELL_DIRECTION direction = CELL_DIRECTION.Any)

Makes a side of a cell block the LOS.

void CellSetSideCrossCost(int cellIndex, CELL_SIDE side, float cost, CELL_DIRECTION direction = CELL_DIRECTION.Any)

Sets the additional cost of crossing an hexagon side. (Review: verify this description matches current behavior.)

void CellSetSplatmapOpacity(int cellIndex, int splatmapIndex, float opacity, bool hideOtherLayers = false)

Sets the underline splatmap opacity of a cell. Optionally hide other terrain layers.

void CellSetTag(Cell cell, int tag)

Tags a cell with a user-defined integer tag. Cell can be later retrieved very quickly using CellGetWithTag.

void CellSetTag(int cellIndex, int tag)

Tags a cell with a user-defined integer tag. Cell can be later retrieved very quickly using CellGetWithTag.

bool CellSetTerritory(int cellIndex, int territoryIndex)

Sets the territory of a cell triggering territory boundary recalculation. Note: changes are not applied immediately, but at end of frame. To apply changes immediately, call Redraw()

Returns: true, if cell was transferred., false otherwise.

bool CellSetTerritory(List<int> cellIndices, int territoryIndex)

Sets the territory of a cell triggering territory boundary recalculation

Returns: true, if cell was transferred., false otherwise.

void CellSetTexture(Cell cell, Texture2D texture, bool isCanvasTexture = false, float textureScale = 1f)

Sets current cell's fill texture. Use CellToggleRegionSurface for more options

void CellSetTexture(int cellIndex, Texture2D texture, bool isCanvasTexture = false, float textureScale = 1f)

Sets current cell's fill texture. Use CellToggleRegionSurface for more options

void CellSetTexture(Cell cell, Texture2D texture, Color tintColor, bool isCanvasTexture = false)

Sets current cell's fill texture. Use CellToggleRegionSurface for more options

void CellSetTexture(int cellIndex, Texture2D texture, Color tintColor, bool isCanvasTexture = false, float textureScale = 1f)

Sets current cell's fill texture. Use CellToggleRegionSurface for more options

void CellSetTexture(Cell cell, Texture2D texture, Color tintColor, Vector2 textureScale, Vector2 textureOffset, bool isCanvasTexture = false)

Sets current cell's fill texture. Use CellToggleRegionSurface for more options

void CellSetTexture(int cellIndex, Texture2D texture, Color tintColor, Vector2 textureScale, Vector2 textureOffset, float textureRotation = 0, bool isCanvasTexture = false)

Sets current cell's fill texture. Use CellToggleRegionSurface for more options

void CellSetVisible(int cellIndex, bool visible, bool excludeFromAnyTerritory = false)

Specifies if a given cell is visible.

void CellSetVisible(List<int> cellIndices, bool visible, bool excludeFromAnyTerritory = false)

Specifies if a given cell is visible.

void CellSetVisible(List<Cell> cells, bool visible, bool excludeFromAnyTerritory = false)

Specifies if a given cell is visible.

bool CellSetVisible(Rect rect, bool visible, bool worldSpace = false)

Specified visibility for a group of cells that lay within a given rectangle

bool CellSetVisible(GameObject obj, bool visible)

Specified visibility for a group of cells that lay within a given gameObject

bool CellSetVisible(Renderer renderer, bool visible)

Specified visibility for a group of cells that lay within a given gameObject

bool CellSetVisible(Collider collider, bool visible)

Specified visibility for a group of cells that lay within a given collider

bool CellSetVisible(Bounds bounds, bool visible)

Specified visibility for a group of cells that lay within a given bounds

bool CellTestLineOfSight(int startCellIndex, int endCellIndex, int cellGroupMask = -1, int lineResolution = 2, bool exhaustiveCheck = false, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool checkLastCell = false)

Checks if there's line of sight (LOS) between two cells

Returns: true, if there's a straight path of non-blocking cells between the two positionsfalse otherwise.

void CellTestLineOfSight(int startCellIndex, List<int> targetCellIndices, int cellGroupMask = -1, int lineResolution = 2, bool exhaustiveCheck = false, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool checkLastCell = false)

Removes any cell from a givel list of indices which are not in LOS

void CellToggleRegionSurface(int cellIndex, bool visible)

Toggles visibility of the surface of a cell

GameObject CellToggleRegionSurface(int cellIndex, bool visible, Texture2D texture, bool isCanvasTexture = false)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

GameObject CellToggleRegionSurface(int cellIndex, bool visible, Color color, bool refreshGeometry = false)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

GameObject CellToggleRegionSurface(int cellIndex, bool visible, Color color, bool refreshGeometry, int textureIndex, bool isCanvasTexture = false)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

GameObject CellToggleRegionSurface(int cellIndex, bool visible, Color color, bool refreshGeometry, Texture2D texture, bool isCanvasTexture = false, float textureScale = 1f)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

GameObject CellToggleRegionSurface(int cellIndex, bool visible, Color color, bool refreshGeometry, int textureIndex, Vector2 textureScale, Vector2 textureOffset, bool isCanvasTexture = false)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

GameObject CellToggleRegionSurface(int cellIndex, bool visible, Color color, bool refreshGeometry, Texture2D texture, Vector2 textureScale, Vector2 textureOffset, float textureRotation = 0, bool localSpace = false, bool isCanvasTexture = false)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

GameObject CellToggleRegionSurface(Cell cell, bool visible, Color color, bool refreshGeometry, Texture2D texture, Vector2 textureScale, Vector2 textureOffset, float textureRotation, bool overlay, bool localSpace, bool isCanvasTexture = false)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

GameObject CellToggleRegionSurface(int cellIndex, bool visible, Color color, bool refreshGeometry, Texture2D texture, Vector2 textureScale, Vector2 textureOffset, float textureRotation, bool overlay, bool localSpace, bool isCanvasTexture)

Colorize specified region of a cell by indexes.

Returns: The generated color surface positioned and oriented over the given cell.

CellGetAtPosition

Source: `/Users/ramcor/Documents/TerrainGridSystem/TerrainGridSystem/Assets/TerrainGridSystem/Scripts/TGSCells.cs`:2949

CellGetConfigurationData

Source: `/Users/ramcor/Documents/TerrainGridSystem/TerrainGridSystem/Assets/TerrainGridSystem/Scripts/TGSCells.cs`:3308

CellSetConfigurationData

Source: `/Users/ramcor/Documents/TerrainGridSystem/TerrainGridSystem/Assets/TerrainGridSystem/Scripts/TGSCells.cs`:3428

Deprecated Territory Methods

event TerritoryClickEvent OnTerritoryClick(TerrainGridSystem tgs, int territoryIndex, int regionIndex, int buttonIndex)

Occurs when user releases the mouse button on the same territory that started clicking

event TerritoryEvent OnTerritoryEnter(TerrainGridSystem tgs, int territoryIndex)

Occurs when the pointer enters a territory

event TerritoryEvent OnTerritoryExit(TerrainGridSystem tgs, int territoryIndex)

Occurs when the pointer exits a territory

event TerritoryHighlightEvent OnTerritoryHighlight(TerrainGridSystem tgs, int territoryIndex, ref bool cancelHighlight)

Occurs when a territory is about to get highlighted

event TerritoryClickEvent OnTerritoryMouseDown(TerrainGridSystem tgs, int territoryIndex, int regionIndex, int buttonIndex)

Occurs when user press the mouse button on a territory

event TerritoryClickEvent OnTerritoryMouseUp(TerrainGridSystem tgs, int territoryIndex, int regionIndex, int buttonIndex)

Occurs when user releases the mouse button on a territory

event TerritoryRegionClickEvent OnTerritoryRegionClick(TerrainGridSystem tgs, int territoryIndex, int regionIndex, int buttonIndex)

Occurs when user releases the mouse button on the same territory region that started clicking

event TerritoryRegionEvent OnTerritoryRegionEnter(TerrainGridSystem tgs, int territoryIndex, int regionIndex)

Occurs when the pointer enters a territory region

event TerritoryRegionEvent OnTerritoryRegionExit(TerrainGridSystem tgs, int territoryIndex, int regionIndex)

Occurs when the pointer exits a territory region

event TerritoryRegionClickEvent OnTerritoryRegionMouseDown(TerrainGridSystem tgs, int territoryIndex, int regionIndex, int buttonIndex)

Occurs when user press the mouse button on a territory region

event TerritoryRegionClickEvent OnTerritoryRegionMouseUp(TerrainGridSystem tgs, int territoryIndex, int regionIndex, int buttonIndex)

Occurs when user releases the mouse button on a territory region

Territory(string name)

Performs territory.

void TerritoryBlink(int territoryIndex, Color color, float duration, int repetitions = 1)

Blinks a territory with "color" and "duration" in seconds.

void TerritoryBlink(List<Territory> territories, Color color, float duration, int repetitions = 1)

Blinks a list of territories with "color" and "duration" in seconds.

void TerritoryBlink(List<int> territoryIndices, Color color, float duration, int repetitions = 1)

Blinks a list of territories with "color" and "duration" in seconds.

void TerritoryCancelAnimations(int territoryIndex, float fadeOutDuration = 0)

Cancels any ongoing visual effect on a territory

void TerritoryCancelAnimations(List<Territory> territories, float fadeOutDuration = 0)

Cancels any ongoing visual effect on a list of territories

void TerritoryCancelAnimations(List<int> territoryIndices, float fadeOutDuration = 0)

Cancels any ongoing visual effect on a list of territories

void TerritoryColorTemp(int territoryIndex, Color color, float duration)

Temporarily colors a territory for "duration" in seconds.

void TerritoryColorTemp(List<Territory> territories, Color color, float duration)

Temporarily colors a list of territories for "duration" in seconds.

void TerritoryColorTemp(List<int> territoryIndices, Color color, float duration)

Temporarily colors a list of territories for "duration" in seconds.

Territory TerritoryCreate(Cell cell)

Create a new territory with a single cell

Returns: The newly created territory

Territory TerritoryCreate(int cellIndex)

Create a new territory with a single cell

Returns: The newly created territory

Territory TerritoryCreate(List<Cell> cells)

Create a new territory from a list of cells

Returns: The newly created territory

Territory TerritoryCreate(List<int> cellIndices)

Create a new territory from a list of cells

Returns: The newly created territory

bool TerritoryDestroy(int territoryIndex)

Removes an existing territory. Cells belonging to the territory will be freed.

Returns: True if successful

void TerritoryDestroyAll()

Destroys all territories

GameObject TerritoryDrawFrontier(Territory territory, int adjacentTerritoryIndex = -1, Material material = null, Color color = default(Color), float thickness = 0)

Creates a gameobject with the frontier for the given territory. Optionally, the frontier could be limited to those segments adjacent to another territory.

GameObject TerritoryDrawFrontier(int territoryIndex, int adjacentTerritoryIndex = -1, Material material = null, Color color = default, float thickness = 0, bool removeExistingCustomFrontiers = true)

Creates a gameobject with the frontier for the given territory. Optionally, the frontier could be limited to those segments adjacent to another territory.

GameObject TerritoryDrawInteriorBorder(int territoryIndex, float padding, float thickness, Color color = default, Color secondColor = default, int regionIndex = 0, float animationSpeed = 0, bool includeEnclaves = false)

Creates a gameobject with the interior border for the given territory with optional padding and thickness.

Returns: The gameobject of the border

GameObject TerritoryDrawInteriorBorder(Territory territory, float padding = -0.7f, float thickness = 3f, Color color = default, Color secondColor = default, int regionIndex = 0, float animationSpeed = 0, bool includeEnclaves = false, bool removeExistingBorders = true)

Creates a gameobject with the interior border for the given territory with optional padding and thickness.

Returns: The gameobject of the border

GameObject TerritoryDrawInteriorBorder(Territory territory, int regionIndex, float padding = -0.7f, float thickness = 3f, Color color = default, Color secondColor = default, float animationSpeed = 0, bool includeEnclaves = false, bool removeExistingBorders = true)

Creates a gameobject with the interior border for the given territory with optional padding and thickness.

Returns: The gameobject of the border

void TerritoryFadeOut(int territoryIndex, Color color, float duration, int repetitions = 1)

Colors a territory and fades it out during "duration" in seconds.

void TerritoryFadeOut(List<Territory> territories, Color color, float duration, int repetitions = 1)

Colors a list of territories with "color" and "duration" in seconds.

void TerritoryFadeOut(List<int> territoryIndices, Color color, float duration, int repetitions = 1)

Colors a list of territories with "color" and "duration" in seconds.

void TerritoryFlash(int territoryIndex, Color color, float duration, int repetitions = 1)

Flashes a territory with "color" and "duration" in seconds.

void TerritoryFlash(List<Territory> territories, Color color, float duration, int repetitions = 1)

Flashes a list of territories with "color" and "duration" in seconds.

void TerritoryFlash(List<int> territoryIndices, Color color, float duration, int repetitions = 1)

Flashes a list of territories with "color" and "duration" in seconds.

int TerritoryGetAdjacentCells(int territoryIndex, List<int> cellIndices, int regionIndex = -1, int otherTerritoryIndex = -1)

Similar to TerritoryGetFrontierCells but returns the cells of the adjacent territory

bool TerritoryGetAdjacentTerritoryForEdge(int territoryIndex, Vector2 vertex1, Vector2 vertex2, out int adjacentTerritoryIndex, out int adjacentTerritoryRegionIndex)

Returns the adjacent territory and region index for a given edge defined by two vertices.

Returns: True if an adjacent territory was found, false otherwise

Territory TerritoryGetAtLocalPosition(Vector3 position)

Returns the territory object under position in local coordinates

Territory TerritoryGetAtLocalPosition(Vector3 position, out int regionIndex)

Returns the territory object under position in local coordinates

Territory TerritoryGetAtPosition(Vector2 localPosition)

Returns the territory object under position in local coordinates

Obsolete: Use TerritoryGetAtWorldPosition or TerritoryGetAtLocalPosition instead.

Territory TerritoryGetAtPosition(Vector3 position, bool worldSpace)

Returns the territory object under position in local or worldSpace coordinates

Territory TerritoryGetAtWorldPosition(Vector3 position)

Returns the territory object under position in worldSpace coordinates

Territory TerritoryGetAtWorldPosition(Vector3 position, out int regionIndex)

Returns the territory object under position in worldSpace coordinates

List<Cell> TerritoryGetCells(int territoryIndex)

Returns a copy of all cells belonging to a territory. Use Territory.cells to access the list without making a copy

void TerritoryGetCells(int territoryIndex, List<Cell> cells)

Returns all cells belonging to a territory into an user given list. See alto territory.cells list.

List<Cell> TerritoryGetCells(int territoryIndex, int regionIndex)

Returns all cells belonging to a territory region

void TerritoryGetCells(int territoryIndex, int regionIndex, List<Cell> cells)

Returns all cells belonging to a territory region into an user given cell list

List<Vector2> TerritoryGetFrontier(int territoryIndex, int regionIndex)

Returns the points that form the frontier of a territory/region (a territory usually has a single region but could include more than one if it gets split) Points returned already have the offset and scale of the grid applied

int TerritoryGetFrontierCells(int territoryIndex, List<int> cellIndices, int regionIndex = -1, bool includeGridEdges = false)

Returns a list of cells that form the frontiers of a given territory

Returns: The number of cells found.

int TerritoryGetFrontierCells(int territoryIndex, int otherTerritoryIndex, List<int> cellIndices, int regionIndex = -1, bool includeGridEdges = false)

Returns a list of cells that forms the frontiers between a given territory and another one.

Returns: The get frontier cells.

GameObject TerritoryGetGameObject(int territoryIndex, int regionIndex = 0)

Returns the shape/surface gameobject of the territory.

Returns: The get game object.

List<Territory> TerritoryGetNeighbors(int territoryIndex)

Returns a list of neighbor territories for specificed cell index.

int TerritoryGetNeighbors(int territoryIndex, List<Territory> territories)

Returns a list of neighbor territories for specificed territory index in the territories parameter.

Vector3 TerritoryGetPosition(int territoryIndex, CentroidType centroidType = CentroidType.BetterCentroid, bool worldSpace = true, int regionIndex = 0)

Gets the territory's center position in world space.

Vector3 TerritoryGetPosition(Territory territory, CentroidType centroidType = CentroidType.BetterCentroid, bool worldSpace = true, int regionIndex = 0)

Gets the territory's center position in world space.

Bounds TerritoryGetRectWorldSpace(int territoryIndex, int regionIndex = 0)

Returns the rect enclosing the territory in world space

int TerritoryGetVertexCount(int territoryIndex, int regionIndex = 0)

Returns the number of vertices of the territory

Vector3 TerritoryGetVertexPosition(int territoryIndex, int vertexIndex, int regionIndex = 0)

Returns the world space position of the vertex of a territory

void TerritoryHideInteriorBorder(int territoryIndex, int regionIndex = -1)

Hides territory border of a territory

void TerritoryHideInteriorBorders()

Hides all territories interior boders

void TerritoryHideRegionSurface(int territoryIndex, int regionIndex = 0)

Uncolorize/hide specified territory by index in the territories collection.

void TerritoryHideRegionSurfaces()

Uncolorize/hide all territories.

bool TerritoryIsNeutral(int territoryIndex)

Returns true if territory is neutral

bool TerritoryIsVisible(int territoryIndex)

Returns true if territory is visible

void TerritoryScaleSurface(int territoryIndex, float scale, int regionIndex = 0)

Scales the gameobject of a colored/textured surface (Review: verify this description matches current behavior.)

void TerritorySetBorderVisible(int territoryIndex, bool visible)

Specifies if a given territory border is visible.

GameObject TerritorySetColor(Territory territory, Color color, int regionIndex = 0)

Sets the color of a territory

GameObject TerritorySetColor(int territoryIndex, Color color, int regionIndex = 0)

Sets the color of a territory

void TerritorySetFrontierColor(int territoryIndex, Color color)

Specifies the color of the territory borders.

GameObject TerritorySetMaterial(int territoryIndex, Material material, int regionIndex = 0)

Assigns a custom material to a territory

void TerritorySetNeutral(int territoryIndex, bool neutral)

Specifies if a given territory is neutral.

GameObject TerritorySetTexture(Territory territory, Texture2D texture, int regionIndex = 0)

Sets the texture of a territory

GameObject TerritorySetTexture(int territoryIndex, Texture2D texture, int regionIndex = 0)

Sets the texture of a territory

void TerritorySetVisible(int territoryIndex, bool visible, bool includeCells = false)

Specifies if a given territory is visible.

void TerritoryToggleRegionSurface(int territoryIndex, bool visible, int regionIndex = 0)

Toggles visibility of a territory surface.

GameObject TerritoryToggleRegionSurface(Territory territory, bool visible, Color color, bool refreshGeometry = false, int regionIndex = 0)

Colorize specified territory by index.

GameObject TerritoryToggleRegionSurface(int territoryIndex, bool visible, Color color, bool refreshGeometry = false, int regionIndex = 0)

Colorize specified territory by index.

GameObject TerritoryToggleRegionSurface(int territoryIndex, bool visible, Color color, bool refreshGeometry, Texture2D texture, int regionIndex = 0)

Colorize specified territory by index.

GameObject TerritoryToggleRegionSurface(int territoryIndex, bool visible, Color color, bool refreshGeometry, Texture2D texture, Vector2 textureScale, Vector2 textureOffset, float textureRotation, bool rotateInLocalSpace, int regionIndex = 0, bool isCanvasTexture = false)

Colorize specified territory by index.

GameObject TerritoryToggleRegionSurface(Territory territory, bool visible, Color color, bool refreshGeometry, Texture2D texture, Vector2 textureScale, Vector2 textureOffset, float textureRotation, bool overlay, bool rotateInLocalSpace, int regionIndex = 0, bool isCanvasTexture = false)

Colorize specified territory by index.

GameObject TerritoryToggleRegionSurface(int territoryIndex, bool visible, Color color, bool refreshGeometry, Texture2D texture, Vector2 textureScale, Vector2 textureOffset, float textureRotation, bool overlay, bool rotateInLocalSpace, int regionIndex = 0, bool isCanvasTexture = false)

Colorize specified territory by index.

void TerritoryUpdateFillColors()

If territory color scheme is set to user-defined, copy those settings into current territories and redraw

TerritoryGetAtPosition

Source: `/Users/ramcor/Documents/TerrainGridSystem/TerrainGridSystem/Assets/TerrainGridSystem/Scripts/TGSTerritories.cs`:1592

Deprecated Pathfinding

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Clears all references to all other triangles and points

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear(T value)

Performs clear.

void Clear()

Performs clear.

void Clear(bool value)

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void Clear()

Performs clear.

void ClearPointData()

Clears point data.

List<PathFinderNode> FindPath(TerrainGridSystem tgs, Cell startCell, Cell endCell, out float totalCost, bool evenLayout)

Finds path.

List<PathFinderNode> FindPath(TerrainGridSystem tgs, Cell startCell, Cell endCell, out float totalCost, bool evenLayout)

Finds path.

List<PathFinderNode> FindPath(TerrainGridSystem tgs, Cell startCell, Cell endCell, out float totalCost, bool evenLayout)

Finds path.

int FindPath(TerrainGridSystem startGrid, Cell startCell, TerrainGridSystem endGrid, Cell endCell, List<(TerrainGridSystem grid, int cellIndex)> path, out float totalCost, FindPathOptions options = null)

Finds a path between two cells that can be in different grids with specified options

List<int> FindPath(int cellIndexStart, int cellIndexEnd, float maxSearchCost = 0, int maxSteps = 0, int cellGroupMask = -1, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool ignoreCellCosts = false, bool includeInvisibleCells = true, int minClearance = 1, float maxCellCrossCost = float.MaxValue, bool cellGroupMaskExactComparison = false)

Returns an optimal path from startPosition to endPosition with options.

Returns: The route consisting of a list of cell indexes.

List<int> FindPath(int cellIndexStart, int cellIndexEnd, out float totalCost, float maxSearchCost = 0, int maxSteps = 0, int cellGroupMask = -1, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool ignoreCellCosts = false, bool includeInvisibleCells = true, int minClearance = 1, float maxCellCrossCost = float.MaxValue, bool cellGroupMaskExactComparison = false)

Returns an optimal path from startPosition to endPosition with options.

Returns: The route consisting of a list of cell indexes.

int FindPath(int cellIndexStart, int cellIndexEnd, List<int> cellIndices, out float totalCost, float maxSearchCost = 0, int maxSteps = 0, int cellGroupMask = -1, CanCrossCheckType canCrossCheckType = CanCrossCheckType.Default, bool ignoreCellCosts = false, bool includeInvisibleCells = true, int minClearance = 1, float maxCellCrossCost = float.MaxValue, bool cellGroupMaskExactComparison = false)

Returns an optimal path from startPosition to endPosition with options.

Returns: The route consisting of a list of cell indexes.

int FindPath(int cellIndexStart, int cellIndexEnd, List<int> cellIndices, out float totalCost, FindPathOptions options)

Returns an optimal path from startPosition to endPosition with options.

Returns: The route consisting of a list of cell indexes.

void FindPathAsync(int cellIndexStart, int cellIndexEnd, Action<FindPathAsyncResult> onComplete, FindPathOptions options = null)

Finds a path asynchronously on a background thread. Thread-safe. Results are returned via callback on the main thread. IMPORTANT: Do not modify grid structure while async pathfinding is in progress.

Task<FindPathAsyncResult> FindPathAsync(int cellIndexStart, int cellIndexEnd, FindPathOptions options = null)

Finds a path asynchronously and returns a Task. Thread-safe. IMPORTANT: Do not modify grid structure while async pathfinding is in progress.

class TGSConfig : MonoBehavior
struct TGSConfigAttribPair
struct TGSConfigEntry

Deprecated Delegates

delegate bool ContainsFunction(float x, float y)

Deprecated Other

event ClickEvent OnClick(TerrainGridSystem tgs, Vector3 worldPosition)

Event callback.

event GridEvent OnEnter(TerrainGridSystem tgs)

Event callback.

event GridEvent OnExit(TerrainGridSystem tgs)

Event callback.

event GridSettingsChangedEvent OnGridSettingsChanged(TerrainGridSystem tgs)

Occurs when some grid settings are changed

event ClickEvent OnMouseDown(TerrainGridSystem tgs, Vector3 worldPosition)

Event callback.

event ClickEvent OnMouseUp(TerrainGridSystem tgs, Vector3 worldPosition)

Event callback.

event PathFindingEvent OnPathFindingCrossCell(TerrainGridSystem tgs, int cellIndex)

Fired when path finding algorithmn evaluates a cell. Use this event to return any extra cost for crossing the cell or 0 to keep the cost at 1.

PathFindingEvent OnPathFindingCrossCell(TerrainGridSystem tgs, int cellIndex)

On path finding cross cell.

enum CELL_DIRECTION
enum CELL_SIDE
enum ApplyMode
Region Clone()

Returns an exact copy of this region

Contour Clone()

Performs clone.

Polygon Clone()

Performs clone.

Region CloneWithoutPointData()

Returns a copy of this region without point/polygon data

ApplyMode ConfigApplyMode

Config apply mode.

ContainsFunction Contains

Contains.

bool Contains(GameObject gameObject)

Performs contains.

bool Contains(GameObject gameObject)

Performs contains.

bool Contains(TriangulationPoint p)

Performs contains.

bool Contains(TriangulationPoint p)

Performs contains.

bool Contains(TriangulationPoint p)

Performs contains.

bool Contains(TriangulationPoint p)

Performs contains.

bool Contains(T value)

Performs contains.

bool Contains(bool value)

Performs contains.

bool Contains(Point2D p)

Performs contains.

bool Contains(double x, double y)

Returns whether the coordinate is inside the bounding box. Note that this will return false if the point is ON the edge of the bounding box. If you want to test for whether the point is inside OR on the rect, use ContainsInclusive

bool Contains(Point2D p)

Performs contains.

bool Contains(Rect2D r)

Performs contains.

bool Contains(Vector3 position)

Returns true if a given position lies within this grid on the X/Z plane

bool ContainsRegion(Region otherRegion)

Performs contains region.

void DestroySurface(bool keepCustomMaterial = false)

Destroys surface.

void Enlarge(float amount)

Performs enlarge.

void FitToScreen(Camera cam = null, float margin = 0f, bool keepAspectRatio = false)

Fits the grid to the current camera viewport on the grid plane. Works with both orthographic and perspective cameras.

Vector2 GetBetterCentroid()

Returns the centroid of the territory using a more accurate algorithm. The centroid always lays inside the polygon whereas the center is the geometric center of the enclosing rectangle and could fall outside an irregular polygon.

Vector2 GetBetterCentroid(int regionIndex = 0)

Returns a better centroid of the territory.

Vector3 GetBottomLeftCornerPosition()

Returns the top/left corner of the grid in world space

IntRect GetBounds(Paths paths)

Gets bounds.

Bounds GetBounds()

Returns the bounds of the grid in world space coordinates.

Returns: The rect.

Vector2 GetCentroid()

Returns the centroid of the territory. The centroid always lays inside the polygon whereas the center is the geometric center of the enclosing rectangle and could fall outside an irregular polygon.

Vector2 GetCentroid(int regionIndex = 0)

Returns the centroid of the territory. A centroid is a better center for a polygon.

Point2D GetCentroid()

Gets the centroid.

FindPathOptions GetDefaultOptions()

Gets default options.

Rect GetRect()

Returns the rectangle area where cells are drawn in local coordinates.

Returns: The rect.

bool GetSideBlocksLOS(CELL_SIDE side)

Returns true if side is blocking LOS (from outside to inside cell)

float GetSideCrossCost(CELL_SIDE side)

Gets the side cross cost.

Returns: The side cross cost.

float GetSidesCost()

Returns the highest crossing cost of all side of a cell

Vector2 GetSize()

Returns the size of the grid in world space coordinates.

void HideHighlightedObject(GameObject go)

Used to cancel highlighting on a given gameobject. This call is ignored if go is not currently highlighted.

void HideHighlightedRegions()

Hides current highlighting effect

bool Intersects(Region other)

Performs intersects.

bool Intersects(Rectangle o)

Performs intersects.

bool Intersects(Rect2D r)

Performs intersects.

void LoadConfiguration()

Call this method to force a configuration load.

class Region
Region(IAdmin entity, bool isBox)

Performs region.

void ReloadFlatMask()

Reloads flat mask.

void ReloadGridMask()

Reloads grid mask.

void SaveConfiguration(TerrainGridSystem tgs)

Stores current grid configuration in this component

void ScaleSurface(GameObject surf, Vector2 center, float scale)

Escales the gameobject of a colored/textured surface

void SetAllSidesCost(float cost)

Sets the same crossing cost for all sides of the hexagon.

void SetBottomLeftCornerPosition(Vector3 position)

Sets the top/left position of the grid in world space

void SetDimensions(int rows, int columns, bool keepCellSize = false)

Sets the dimensions of the grid in one step. This is faster than setting rowCount and columnCount separately.

void SetDimensionsAndType(int rows, int columns, GridTopology gridTopology, bool keepCellSize = false)

Sets the dimensions of the grid in one step. This is faster than setting rowCount and columnCount separately.

void SetGridCenterWorldPosition(Vector3 position, bool snapToGrid)

Updates grid center position

void SetPoints(List<Vector2> points)

Sets points.

void SetPoints(List<Point> points)

Sets points.

void SetSideBlocksLOS(CELL_SIDE side, bool blocks)

Specifies if LOS is blocked through this side (from outside to inside cell)

void SetSideCrossCost(CELL_SIDE side, float cost)

Assigns a crossing cost for a given hexagonal side

void SetSize(double w, double h)

Sets size.

void SetSize(Vector2 size)

Sets the size of the grid in world space coordinates.

void SetTerrain(GameObject terrain)

Sets the terrain gameobject. This is equivalent to use the terrainObject property.

Vector3 SnapToCell(Vector3 position, bool worldSpace = true, bool snapToCenter = true)

Snaps a position to the grid (Review: verify this description matches current behavior.)

void UpdateBounds()

Updates bounds.

Was this page helpful?