DC/RTS Documentation  v1.62
A Unity3D System Incorporating the Functionality of a Dungeon Crawler or Real Time Strategy System
 All Classes Files Functions Variables Enumerations Enumerator Properties Pages
GridGenerator Class Reference

This class generates a grid a long the xz plane. More...

Inheritance diagram for GridGenerator:

Classes

class  GridComparer
 Used for Sorting GridSquares within a Data Structure that Contains an IComparer. More...
 
class  GridSquare
 Represents a 3D GridSquare within the xz-plane. More...
 
class  GridSquareQuadrant
 Used for Being Able to Easily keep Track of GridSquares Tied to Specific Quadrants. More...
 

Public Member Functions

List< GridSquareCalculateGridSquares (int rowSize, int colSize, int initRow, int initCol, bool addToMainGrid)
 Calculates a List of GridSquare objects More...
 
int[] DetermineGridCheckPoints (Vector3 moveToPoint, bool flag)
 Determines the Grid Coordinates of a Desired Vector3 within the GridGenerator. More...
 
PathFinder getPathFinder ()
 Gets the PathFinder associated with this GridGenerator. More...
 
void CalculateNewPath (Vector3 init, Vector3 final)
 Wrapper Around PathFinder.CalculateNewPath for Calculating the Movement Path Given an Initial and Final World Position. More...
 
void CalculateNewPath (Transform moveObj, Vector3 final)
 Wrapper Around PathFinder.CalculateNewPath for Calculating the Movement Path Given a Unity3D Transform Object and a Final World Position. More...
 
GridSquare getDesiredGridSquare (int r, int c)
 Retrieves a GridSquare from a specific Row and Column. More...
 
GridSquareQuadrant getDesiredQuadrant (int qr, int qc)
 Retrieves a GridQuadrant from a specific Quad Row and Quad Column. More...
 
List< GridSquaregetCalculatedPathTiles ()
 Allows for Retrieval of the Paths Calculated Path Tiles. More...
 
void ResetGrid ()
 Resets both the GridQuandrants and GridSquares that are attached to the GridQuadrants. More...
 
int getRows ()
 Returns the total number of grid rows. More...
 
int getColumns ()
 Returns the total number of grid columns. More...
 

Static Public Member Functions

static RaycastHit CollectedRaycastInfo (Ray ray, float dist, int layerMask)
 Utility function for Collecting Information about a Raycast. More...
 

Public Attributes

LayerMask IgnoreMask
 The Layermask this GridGenerator will Ignore (Control Objects, NPC Objects, Creature Objects, etc) More...
 
int Rows = 16
 The Number of Rows this GridGenerator is Made Up of. More...
 
int Columns = 16
 The Number of Columns this GridGenerator is Made Up of. More...
 
int GridWidth = 10
 The Width of an Individual GridSquare. More...
 
int GridHeight = 20
 The Height of an Individual GridSquare. More...
 
int GridDepth = 10
 The Depth of an Individual GridSquare. More...
 
int GridQuadSize = 8
 Used for Dividing the Grid Into Individual Quadrants Made Up of GridQuadSize GridSquares. More...
 
float MinSlopeAngle = 5.0f
 The Minimum Slope Angle to Determine. More...
 
float MaxSlopeAngle = 30.0f
 The Maximum Slope Angle to Determine. More...
 
float Rigidity = .1f
 Linear Rigidity, in Terms of How Bumpy the GridGenerator will Allow a GridSquare Along it's GridSquare Generation. More...
 
float AngularRigidity = 0.01f
 Angular Rigidity, in Terms of the Factor of how Smooth a Slope is. More...
 
bool EightAdjacentSquares = true
 Eight Adjacent Squares (true) or Four Adjacent Squares (false)? More...
 

Detailed Description

This class generates a grid a long the xz plane.

The grid is made up of GridQuadrants that are made up of GridSquares, where the grid is determined based off raycasts. The calculated grids are stored in a 2D array of GridSquares, which can be acessed by: getDesiredGridSquare(int r, int c) function. This GridGenerator is utilized within the PathFinder.cs object, with the A* pathfinding implementation.

For the grid to generate properly, at this time, slopes need to be parallel to either the x or z axis.

Member Function Documentation

List<GridSquare> GridGenerator.CalculateGridSquares ( int  rowSize,
int  colSize,
int  initRow,
int  initCol,
bool  addToMainGrid 
)

Calculates a List of GridSquare objects

Parameters
rowSizeThe size of the row count
colSizeThe size of the column count
initRowThe initial row to start at
initColThe initial column to start at
addToMainGridAdd calculated GridSquares to the Main GridGenerator or return just a List of GridSquares?
void GridGenerator.CalculateNewPath ( Vector3  init,
Vector3  final 
)

Wrapper Around PathFinder.CalculateNewPath for Calculating the Movement Path Given an Initial and Final World Position.

Parameters
initInitial Position.
finalFinal Position.
void GridGenerator.CalculateNewPath ( Transform  moveObj,
Vector3  final 
)

Wrapper Around PathFinder.CalculateNewPath for Calculating the Movement Path Given a Unity3D Transform Object and a Final World Position.

Parameters
moveObjThe Unity3D Transform Object to Move.
finalThe Final Position.
static RaycastHit GridGenerator.CollectedRaycastInfo ( Ray  ray,
float  dist,
int  layerMask 
)
static

Utility function for Collecting Information about a Raycast.

Parameters
rayThe Ray to Cast
distThe Distance
layerMaskThe Layer Mask to Ignore
Returns
The RaycastHit Information
int [] GridGenerator.DetermineGridCheckPoints ( Vector3  moveToPoint,
bool  flag 
)

Determines the Grid Coordinates of a Desired Vector3 within the GridGenerator.

Parameters
moveToPointThe Desired Move To Point
flagIf true returns actual grid coordinates, if false returns {-1, -1} if the grid coordinate doesn't exist
Returns
A Two Element Array containing GridSquare Coordinates
List<GridSquare> GridGenerator.getCalculatedPathTiles ( )

Allows for Retrieval of the Paths Calculated Path Tiles.

Returns
List of Grid Squares
int GridGenerator.getColumns ( )

Returns the total number of grid columns.

Returns
Number of Columns
GridSquare GridGenerator.getDesiredGridSquare ( int  r,
int  c 
)

Retrieves a GridSquare from a specific Row and Column.

Parameters
rThe Row
cThe Column
Returns
The GridSquare
GridSquareQuadrant GridGenerator.getDesiredQuadrant ( int  qr,
int  qc 
)

Retrieves a GridQuadrant from a specific Quad Row and Quad Column.

Parameters
qrThe Quadrant Row
qcThe Quadrant Column
Returns
The Selected GridSquareQuadrant
PathFinder GridGenerator.getPathFinder ( )

Gets the PathFinder associated with this GridGenerator.

Returns
int GridGenerator.getRows ( )

Returns the total number of grid rows.

Returns
Number of Rows
void GridGenerator.ResetGrid ( )

Resets both the GridQuandrants and GridSquares that are attached to the GridQuadrants.

Member Data Documentation

float GridGenerator.AngularRigidity = 0.01f

Angular Rigidity, in Terms of the Factor of how Smooth a Slope is.

int GridGenerator.Columns = 16

The Number of Columns this GridGenerator is Made Up of.

bool GridGenerator.EightAdjacentSquares = true

Eight Adjacent Squares (true) or Four Adjacent Squares (false)?

int GridGenerator.GridDepth = 10

The Depth of an Individual GridSquare.

int GridGenerator.GridHeight = 20

The Height of an Individual GridSquare.

This Height is also Used for Calculating from the Top Down, it's a Very Important Factor in the Calculation.

int GridGenerator.GridQuadSize = 8

Used for Dividing the Grid Into Individual Quadrants Made Up of GridQuadSize GridSquares.

int GridGenerator.GridWidth = 10

The Width of an Individual GridSquare.

LayerMask GridGenerator.IgnoreMask

The Layermask this GridGenerator will Ignore (Control Objects, NPC Objects, Creature Objects, etc)

float GridGenerator.MaxSlopeAngle = 30.0f

The Maximum Slope Angle to Determine.

float GridGenerator.MinSlopeAngle = 5.0f

The Minimum Slope Angle to Determine.

float GridGenerator.Rigidity = .1f

Linear Rigidity, in Terms of How Bumpy the GridGenerator will Allow a GridSquare Along it's GridSquare Generation.

int GridGenerator.Rows = 16

The Number of Rows this GridGenerator is Made Up of.


The documentation for this class was generated from the following file: