Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.NavigationEngine_PolygonCollider Class Reference
Inheritance diagram for AC.NavigationEngine_PolygonCollider:
AC.NavigationEngine

Public Member Functions

override void OnReset (NavigationMesh navMesh)
 Called when the scene begins or is reset. More...
 
override void TurnOn (NavigationMesh navMesh)
 Enables the NavMesh so that it can be used in pathfinding. More...
 
override Vector3[] GetPointsArray (Vector3 _originPos, Vector3 _targetPos, AC.Char _char=null)
 Calculates a path between two points. More...
 
override void ResetHoles (NavigationMesh navMesh)
 
override Vector3 GetPointNear (Vector3 point, float minDistance, float maxDistance)
 Finds a random position surrounding a given point on a NavMesh. More...
 
override string GetPrefabName ()
 Gets the name of a "helper" prefab to list in the Scene Manager. More...
 
override void SceneSettingsGUI ()
 
override NavigationMesh NavigationMeshGUI (NavigationMesh _target)
 
override void DrawGizmos (GameObject navMeshOb)
 Draws gizmos in the Scene/Game window. More...
 
- Public Member Functions inherited from AC.NavigationEngine
Vector3[] GetPointsArray (Vector3 startPosition, Vector3[] targetPositions, AC.Char _char=null)
 Calculates a path between multiple points. More...
 

Static Public Attributes

static Collider2D[] results = new Collider2D[1]
 

Protected Member Functions

void ResetHoles (NavigationMesh navMesh, bool rebuild)
 
int[] buildSpanningTree (int source, int destination, float[,] weight)
 
int[] getShortestPath (int source, int destination, int[] precede)
 
float[,] pointsToWeight (Vector2[] points, bool useCache=false, int polyIndex=0)
 
Vector2 GetNearestToMesh (Vector2 vertex, PolygonCollider2D poly, bool hasMultiple)
 
Vector2 GetNearestOffMesh (Vector2 vertex, PolygonCollider2D poly)
 
Vector2[] AddEndsToList (Vector2[] points, Vector2 originPos, Vector2 targetPos, bool checkForDuplicates=true)
 
bool IsLineClear (Vector2 startPos, Vector2 endPos)
 
Vector2 GetLineIntersect (Vector2 startPos, Vector2 endPos)
 
void AddCharHoles (PolygonCollider2D[] navPolys, AC.Char charToExclude, NavigationMesh navigationMesh)
 
void RebuildVertexArray (Transform navMeshTransform, PolygonCollider2D poly, int polyIndex)
 
void CalcSearchRadius (NavigationMesh navMesh)
 
void CreateCache (int i)
 

Protected Attributes

int MAXNODES = 1000
 
List< float[,]> allCachedGraphs = new List<float[,]>()
 
float searchRadius = 0.02f
 
float searchStep
 
Vector2 dir_n = new Vector2 (0f, 1f)
 
Vector2 dir_s = new Vector2 (0f, -1f)
 
Vector2 dir_w = new Vector2 (-1f, 0f)
 
Vector2 dir_e = new Vector2 (1f, 0f)
 
Vector2 dir_ne = new Vector2 (0.71f, 0.71f)
 
Vector2 dir_se = new Vector2 (0.71f, -0.71f)
 
Vector2 dir_sw = new Vector2 (-0.71f, -0.71f)
 
Vector2 dir_nw = new Vector2 (-0.71f, 0.71f)
 
Vector2 dir_nne = new Vector2 (0.37f, 0.93f)
 
Vector2 dir_nee = new Vector2 (0.93f, 0.37f)
 
Vector2 dir_see = new Vector2 (0.93f, -0.37f)
 
Vector2 dir_sse = new Vector2 (0.37f, -0.93f)
 
Vector2 dir_ssw = new Vector2 (-0.37f, -0.93f)
 
Vector2 dir_sww = new Vector2 (-0.93f, -0.37f)
 
Vector2 dir_nww = new Vector2 (-0.93f, 0.37f)
 
Vector2 dir_nnw = new Vector2 (-0.37f, 0.93f)
 
List< Vector2[]> allVertexData = new List<Vector2[]>()
 
- Protected Attributes inherited from AC.NavigationEngine
Vector2[] vertexData
 

Properties

override bool RequiresNavMeshGameObject [get]
 
- Properties inherited from AC.NavigationEngine
virtual bool RequiresNavMeshGameObject [get]
 

Additional Inherited Members

- Public Attributes inherited from AC.NavigationEngine
bool is2D = false
 

Member Function Documentation

◆ DrawGizmos()

override void AC.NavigationEngine_PolygonCollider.DrawGizmos ( GameObject  navMeshOb)
virtual

Draws gizmos in the Scene/Game window.

Parameters
navMeshObThe NavigationMesh gameobject to draw gizmos for

Reimplemented from AC.NavigationEngine.

◆ GetPointNear()

override Vector3 AC.NavigationEngine_PolygonCollider.GetPointNear ( Vector3  point,
float  minDistance,
float  maxDistance 
)
virtual

Finds a random position surrounding a given point on a NavMesh.

Parameters
pointThe given point on the NavMesh
minDistanceThe minimum distance between the given point and the random point
maxDistanceThe maximum distance between the given point and the random point
Returns
A random position surrounding the given point. If a suitable point is not found, the original point will be returned.

Reimplemented from AC.NavigationEngine.

◆ GetPointsArray()

override Vector3 [] AC.NavigationEngine_PolygonCollider.GetPointsArray ( Vector3  startPosition,
Vector3  targetPosition,
AC.Char  _char = null 
)
virtual

Calculates a path between two points.

Parameters
startPositionThe start position
targetPositionThe intended end position
_charThe character (see Char) who this path is for (only used in PolygonCollider pathfinding)
Returns
The path to take, as an array of Vector3s.

Reimplemented from AC.NavigationEngine.

◆ GetPrefabName()

override string AC.NavigationEngine_PolygonCollider.GetPrefabName ( )
virtual

Gets the name of a "helper" prefab to list in the Scene Manager.

Returns
The name of the prefab to list in SceneManager. The prefab must be placed in the Assets/AdventureCreator/Prefabs/Navigation folder. If nothing is returned, no prefab will be listed.

Reimplemented from AC.NavigationEngine.

◆ NavigationMeshGUI()

override NavigationMesh AC.NavigationEngine_PolygonCollider.NavigationMeshGUI ( NavigationMesh  _target)
virtual

Provides a space for any custom Editor GUI code that should be displayed in the NavigationMesh inspector.

Reimplemented from AC.NavigationEngine.

◆ OnReset()

override void AC.NavigationEngine_PolygonCollider.OnReset ( NavigationMesh  navMesh)
virtual

Called when the scene begins or is reset.

Parameters
navMeshThe NavigationMesh that is active in the scene.

Reimplemented from AC.NavigationEngine.

◆ ResetHoles()

override void AC.NavigationEngine_PolygonCollider.ResetHoles ( NavigationMesh  navMesh)
virtual

Integrates all PolygonCollider2D objects in the polygonColliderHoles List into the base PolygonCollider2D shape. This is called automatically by AddHole() and RemoveHole() once the List has been amended

Reimplemented from AC.NavigationEngine.

◆ SceneSettingsGUI()

override void AC.NavigationEngine_PolygonCollider.SceneSettingsGUI ( )
virtual

Provides a space for any custom Editor GUI code that should be displayed in SceneManager.

Reimplemented from AC.NavigationEngine.

◆ TurnOn()

override void AC.NavigationEngine_PolygonCollider.TurnOn ( NavigationMesh  navMesh)
virtual

Enables the NavMesh so that it can be used in pathfinding.

Parameters
navMeshObThe NavigationMesh gameobject to enable

Reimplemented from AC.NavigationEngine.