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

Public Member Functions

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

Public Attributes

bool is2D = false
 

Protected Attributes

Vector2[] vertexData
 

Properties

virtual bool RequiresNavMeshGameObject [get]
 

Detailed Description

A base class for all navigation methods. Subclasses of this script are used to return a navigation path, as an array of Vector3s, based on two positions. A number of functions to allow easier integration within SceneManager are also included. To create a new navigation method, create a new subclass of this script with the name syntax "NavigationEngine_NewMethodName", and add "NewMethodName" to the AC_NavigationMethod enum in Enums.cs. The method will then be an option in the "Navigation engine" popup in the Scene Manager.

Member Function Documentation

◆ DrawGizmos()

virtual void AC.NavigationEngine.DrawGizmos ( GameObject  navMeshOb)
virtual

Draws gizmos in the Scene/Game window.

Parameters
navMeshObThe NavigationMesh gameobject to draw gizmos for

Reimplemented in AC.NavigationEngine_PolygonCollider.

◆ GetPointNear()

virtual Vector3 AC.NavigationEngine.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 in AC.NavigationEngine_PolygonCollider, AC.NavigationEngine_meshCollider, and AC.NavigationEngine_UnityNavigation.

◆ GetPointsArray() [1/2]

virtual Vector3 [] AC.NavigationEngine.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 in AC.NavigationEngine_UnityNavigation, AC.NavigationEngine_meshCollider, and AC.NavigationEngine_PolygonCollider.

◆ GetPointsArray() [2/2]

Vector3 [] AC.NavigationEngine.GetPointsArray ( Vector3  startPosition,
Vector3[]  targetPositions,
AC.Char  _char = null 
)

Calculates a path between multiple points.

Parameters
startPositionThe start position
targetPositionsAn array of positions to travel through along the path, with the last entry being the intended destination
_charThe character (see Char) who this path is for (only used in PolygonCollider pathfinding)
Returns
The path to take, as an array of Vector3s.

◆ GetPrefabName()

virtual string AC.NavigationEngine.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 in AC.NavigationEngine_PolygonCollider, and AC.NavigationEngine_meshCollider.

◆ NavigationMeshGUI()

virtual NavigationMesh AC.NavigationEngine.NavigationMeshGUI ( NavigationMesh  _target)
virtual

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

Reimplemented in AC.NavigationEngine_PolygonCollider.

◆ OnReset()

virtual void AC.NavigationEngine.OnReset ( NavigationMesh  navMesh)
virtual

Called when the scene begins or is reset.

Parameters
navMeshThe NavigationMesh that is active in the scene.

Reimplemented in AC.NavigationEngine_PolygonCollider, and AC.NavigationEngine_meshCollider.

◆ ResetHoles()

virtual void AC.NavigationEngine.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 in AC.NavigationEngine_PolygonCollider, and AC.NavigationEngine_meshCollider.

◆ SceneSettingsGUI()

virtual void AC.NavigationEngine.SceneSettingsGUI ( )
virtual

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

Reimplemented in AC.NavigationEngine_PolygonCollider, AC.NavigationEngine_meshCollider, and AC.NavigationEngine_UnityNavigation.

◆ TurnOn()

virtual void AC.NavigationEngine.TurnOn ( NavigationMesh  navMesh)
virtual

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

Parameters
navMeshObThe NavigationMesh gameobject to enable

Reimplemented in AC.NavigationEngine_PolygonCollider, AC.NavigationEngine_meshCollider, and AC.NavigationEngine_UnityNavigation.

Member Data Documentation

◆ is2D

bool AC.NavigationEngine.is2D = false

If True, then navigation raycasts performed by PlayerMovement will be done in 2D, rather than 3D

Property Documentation

◆ RequiresNavMeshGameObject

virtual bool AC.NavigationEngine.RequiresNavMeshGameObject
get

Returns True if the engine relies on a specific GameObject for pathfinding