Core Types & Enums
advanced scriptingTerrain Grid System 2 · Scripting Support (C#)
API Reference
Cell Type
Vector2 center)Performs cell.
Performs cell.
Cell Fields
Vector2 betterCentroidBetter centroid.
bool[] blocksLOSUsed by specify if LOS is blocked across cell sides.
bool canCrossIf this cell blocks path finding.
bool canCrossCan cross.
Vector2 centroidCentroid.
Point centroidCentroid.
byte clearanceDistance to nearest blocking cell
ushort row, columnColumn.
int columnColumn.
Description not found in source.
float[] crossCostUsed 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, textureOffsetCross cost.
bool customizedCustomized.
int groupGroup for this cell. A different group can be assigned to use along with FindPath cellGroupMask argument.
int indexThe index of the cell in the cells array
bool visibleVisible.
bool visibleReturns the actual visibility state of the cell. The setter will set only visibleSelf and not visibleByRules or visibleAlways.
bool visibleVisible.
bool visibleAlwaysGets or sets whether the cell is always visible, regardless of other rules.
bool visibleAlwaysVisible always.
bool visibleByRulesGets or sets the visibility of the cell based on rules.
bool visibleSelfGets 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.
Region Type
class RegionIAdmin entity, bool isBox)Performs region.
Region Fields
List<Renderer> childrenSurfacesIf the gameobject contains one or more children surfaces with name splitSurface due to having +65000 vertices
GameObject customBorderGameObjectReference to a custom border drawn using CellDrawBorder or TerritoryDrawFrontier
GameObject customFrontiersGameObjectThe reference to custom territory borders if drawn (not interior; interior borders are stored in each region)
bool customIsCanvasTextureCustom is canvas texture.
Material customMaterialCustom material.
bool customRotateInLocalSpaceCustom rotate in local space.
Description not found in source.
float customTextureRotationCustom texture rotation.
IAdmin entityEntity.
Color fillColorFill color.
Territory Type
string name)Performs territory.
Territory Fields
List<Cell> cellsCells in this region.
List<Cell> cellsCells.
VoronoiCell[] cellsCells.
List<Cell> cellsComplete array of states and cells and the territory name they belong to.
Description not found in source.
Shared Fields
GameObject interiorBorderGameObjectReference to a custom border drawn using TerritoryDrawInteriorBorder
bool isEmptyIs empty.
bool isFlatDetermines if this region should be rendered flat to the terrain
int iterationUsed internally to optimize certain algorithms
string nameOptional territory name.
List<Cell> neighborsCells adjacent to this cell
List<Territory> neighborsList of other territories sharing some border with this territory
bool neutralA neutral territory doesn't show conflicting borders with adjacent territories
List<Vector2> pointsPoints coordinates with applied grid offset and scale
List<Point> pointsPoints.
Polygon polygonPolygon.
Rect rect2DScaled rect (rect with grid offset and scale applied)
float rect2DAreaRect d area.
double rect2DAreaRect d area.
Region regionPhysical surface-related data
List<Region> regionsList of physical regions. Usually territories have only one region, but they can be split by assigning cells to other territories
Renderer rendererRenderer.
MeshRenderer rendererRenderer.
int renderingOrderUsed internally to ensure smaller territory surfaces are rendered before others
List<Segment> segmentsOriginal grid segments. Segments coordinates are not scaled.
List <Segment> segmentsSegments.
int sortIndexUsed internally to keep territory regions list order during updates
GameObject surfaceGameObjectSurface game object.
short territoryIndexThe 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 territoryIndexTerritory index.
int territoryIndexTerritory index.
int territoryIndexTerritory index.
int usedFlag, usedFlag2Used for performance optimizations.
partial class Cell : AdminEntitypartial class Territory: AdminEntitybool isEmptyReturns true if thi territory has no regions
Types & Enums
enum CELL_DIRECTIONenum CELL_SIDEvoid ClearPointData()Clears point data.
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
ContainsFunction ContainsContains.
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.
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.
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.
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
bool Intersects(Region other)Performs intersects.
bool Intersects(Rectangle o)Performs intersects.
bool Intersects(Rect2D r)Performs intersects.
void SetAllSidesCost(float cost)Sets the same crossing cost for all sides of the hexagon.
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 UpdateBounds()Updates bounds.
Delegates
delegate bool ContainsFunction(float x, float y)Suggest an improvement
Help us improve this documentation page.