TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.GridManager Class Reference

A manager required in your scenes that use CharacterGridMovement. More...

Inheritance diagram for MoreMountains.TopDownEngine.GridManager:
MoreMountains.Tools.MMSingleton< T >

Public Types

enum  DebugDrawModes { TwoD , ThreeD }
 the possible types of debug modes More...

Public Member Functions

virtual bool CellIsOccupied (Vector3 cellCoordinates)
 Returns true if the cell at the specified coordinates is occupied, false otherwise.
virtual void OccupyCell (Vector3 cellCoordinates)
 Marks the specified cell as occupied.
virtual void FreeCell (Vector3 cellCoordinates)
 Marks the specified cell as unoccupied.
virtual void SetNextPosition (GameObject trackedObject, Vector3Int cellCoordinates)
 Sets the next position of the specified object traveling on the grid. The next position is the position the object will be at when it reaches its destination grid cell.
virtual void SetLastPosition (GameObject trackedObject, Vector3Int cellCoordinates)
 Sets the last position of the specified object traveling on the grid. The last position is the position the object was at the last time it passed on a perfect tile.
virtual Vector3Int WorldToCellCoordinates (Vector3 worldPosition)
 Returns the corresponding world coordinates of a grid position.
virtual Vector3 CellToWorldCoordinates (Vector3Int coordinates)
 Converts cell coordinates into their world position.
virtual Vector3 ComputeGridPosition (Vector3 targetPosition)
 Returns the grid position of the specified vector in world position.
virtual Vector3 ComputeWorldPosition (Vector3 targetPosition)
 Computes the grid position of a vector3 specified in grid units.

Public Attributes

Transform GridOrigin
 the origin of the grid in world space
float GridUnitSize = 1f
 the size of each square grid cell
bool DrawDebugGrid = true
 whether or not to draw the debug grid
DebugDrawModes DebugDrawMode = DebugDrawModes.TwoD
 the mode in which to draw the debug grid
int DebugGridSize = 30
 the size (in squares of the debug grid)
Color CellBorderColor = new Color(60f, 221f, 255f, 1f)
 the color to use to draw the debug grid lines
Color InnerColor = new Color(60f, 221f, 255f, 0.3f)
 the color to use to draw the debug grid cells backgrounds
List< Vector3 > OccupiedGridCells
 a list of all cells currently occupied
Dictionary< GameObject, Vector3Int > LastPositions
 a dictionary holding all last positions registered by objects traveling on the grid
Dictionary< GameObject, Vector3Int > NextPositions
 a dictionary holding all next positions registered by objects traveling on the grid

Protected Member Functions

virtual void Start ()
 On start we initialize our lists and dictionaries.
virtual void OnDrawGizmos ()
 On draw gizmos, draws a debug grid.
virtual void DrawCell2D (int a, int b)
 Draws a 2D debug cell.
virtual void DrawCell3D (int a, int b)
 Draws a 3D debug cell.
Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< T >
virtual void Awake ()
 On awake, we initialize our instance. Make sure to call base.Awake() in override if you need awake.
virtual void InitializeSingleton ()
 Initializes the singleton.

Static Protected Member Functions

static void InitializeStatics ()
 Statics initialization to support enter play modes.

Protected Attributes

Vector3 _newGridPosition
Vector3 _debugOrigin = Vector3.zero
Vector3 _debugDestination = Vector3.zero
Vector3Int _workCoordinate = Vector3Int.zero

Additional Inherited Members

Static Public Member Functions inherited from MoreMountains.Tools.MMSingleton< T >
static T TryGetInstance ()
Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< T >
static T _instance
Properties inherited from MoreMountains.Tools.MMSingleton< T >
static bool HasInstance [get]
static T Current [get]
static T Instance [get]
 Singleton design pattern.

Detailed Description

A manager required in your scenes that use CharacterGridMovement.

Member Enumeration Documentation

◆ DebugDrawModes

the possible types of debug modes

Enumerator
TwoD 
ThreeD 

Member Function Documentation

◆ CellIsOccupied()

virtual bool MoreMountains.TopDownEngine.GridManager.CellIsOccupied ( Vector3 cellCoordinates)
virtual

Returns true if the cell at the specified coordinates is occupied, false otherwise.

Parameters
cellCoordinates
Returns

◆ CellToWorldCoordinates()

virtual Vector3 MoreMountains.TopDownEngine.GridManager.CellToWorldCoordinates ( Vector3Int coordinates)
virtual

Converts cell coordinates into their world position.

Parameters
coordinates
Returns

◆ ComputeGridPosition()

virtual Vector3 MoreMountains.TopDownEngine.GridManager.ComputeGridPosition ( Vector3 targetPosition)
virtual

Returns the grid position of the specified vector in world position.

Parameters
targetPosition
Returns

◆ ComputeWorldPosition()

virtual Vector3 MoreMountains.TopDownEngine.GridManager.ComputeWorldPosition ( Vector3 targetPosition)
virtual

Computes the grid position of a vector3 specified in grid units.

Parameters
targetPosition
Returns

◆ DrawCell2D()

virtual void MoreMountains.TopDownEngine.GridManager.DrawCell2D ( int a,
int b )
protectedvirtual

Draws a 2D debug cell.

Parameters
a
b

◆ DrawCell3D()

virtual void MoreMountains.TopDownEngine.GridManager.DrawCell3D ( int a,
int b )
protectedvirtual

Draws a 3D debug cell.

Parameters
a
b

◆ FreeCell()

virtual void MoreMountains.TopDownEngine.GridManager.FreeCell ( Vector3 cellCoordinates)
virtual

Marks the specified cell as unoccupied.

Parameters
cellCoordinates

◆ InitializeStatics()

void MoreMountains.TopDownEngine.GridManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes.

◆ OccupyCell()

virtual void MoreMountains.TopDownEngine.GridManager.OccupyCell ( Vector3 cellCoordinates)
virtual

Marks the specified cell as occupied.

Parameters
cellCoordinates

◆ OnDrawGizmos()

virtual void MoreMountains.TopDownEngine.GridManager.OnDrawGizmos ( )
protectedvirtual

On draw gizmos, draws a debug grid.

◆ SetLastPosition()

virtual void MoreMountains.TopDownEngine.GridManager.SetLastPosition ( GameObject trackedObject,
Vector3Int cellCoordinates )
virtual

Sets the last position of the specified object traveling on the grid. The last position is the position the object was at the last time it passed on a perfect tile.

◆ SetNextPosition()

virtual void MoreMountains.TopDownEngine.GridManager.SetNextPosition ( GameObject trackedObject,
Vector3Int cellCoordinates )
virtual

Sets the next position of the specified object traveling on the grid. The next position is the position the object will be at when it reaches its destination grid cell.

Parameters
trackedObject
cellCoordinates

◆ Start()

virtual void MoreMountains.TopDownEngine.GridManager.Start ( )
protectedvirtual

On start we initialize our lists and dictionaries.

◆ WorldToCellCoordinates()

virtual Vector3Int MoreMountains.TopDownEngine.GridManager.WorldToCellCoordinates ( Vector3 worldPosition)
virtual

Returns the corresponding world coordinates of a grid position.

Parameters
worldPosition
Returns

Member Data Documentation

◆ _debugDestination

Vector3 MoreMountains.TopDownEngine.GridManager._debugDestination = Vector3.zero
protected

◆ _debugOrigin

Vector3 MoreMountains.TopDownEngine.GridManager._debugOrigin = Vector3.zero
protected

◆ _newGridPosition

Vector3 MoreMountains.TopDownEngine.GridManager._newGridPosition
protected

◆ _workCoordinate

Vector3Int MoreMountains.TopDownEngine.GridManager._workCoordinate = Vector3Int.zero
protected

◆ CellBorderColor

Color MoreMountains.TopDownEngine.GridManager.CellBorderColor = new Color(60f, 221f, 255f, 1f)

the color to use to draw the debug grid lines

◆ DebugDrawMode

DebugDrawModes MoreMountains.TopDownEngine.GridManager.DebugDrawMode = DebugDrawModes.TwoD

the mode in which to draw the debug grid

◆ DebugGridSize

int MoreMountains.TopDownEngine.GridManager.DebugGridSize = 30

the size (in squares of the debug grid)

◆ DrawDebugGrid

bool MoreMountains.TopDownEngine.GridManager.DrawDebugGrid = true

whether or not to draw the debug grid

◆ GridOrigin

Transform MoreMountains.TopDownEngine.GridManager.GridOrigin

the origin of the grid in world space

◆ GridUnitSize

float MoreMountains.TopDownEngine.GridManager.GridUnitSize = 1f

the size of each square grid cell

◆ InnerColor

Color MoreMountains.TopDownEngine.GridManager.InnerColor = new Color(60f, 221f, 255f, 0.3f)

the color to use to draw the debug grid cells backgrounds

◆ LastPositions

Dictionary<GameObject, Vector3Int> MoreMountains.TopDownEngine.GridManager.LastPositions

a dictionary holding all last positions registered by objects traveling on the grid

◆ NextPositions

Dictionary<GameObject, Vector3Int> MoreMountains.TopDownEngine.GridManager.NextPositions

a dictionary holding all next positions registered by objects traveling on the grid

◆ OccupiedGridCells

List<Vector3> MoreMountains.TopDownEngine.GridManager.OccupiedGridCells

a list of all cells currently occupied


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Managers/GridManager.cs