Adventure Creator  1.57
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2017
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...
 
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 SetVisibility (bool visibility)
 Sets the visibility state of any relevant prefabs. This is called when the "NavMesh" visibility buttons in SceneManager are clicked on. 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
 

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

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.

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.

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 indended 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_PolygonCollider, AC.NavigationEngine_meshCollider, and AC.NavigationEngine_UnityNavigation.

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, AC.NavigationEngine_meshCollider, and AC.NavigationEngine_UnityNavigation.

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.

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.

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.

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.

virtual void AC.NavigationEngine.SetVisibility ( bool  visibility)
virtual

Sets the visibility state of any relevant prefabs. This is called when the "NavMesh" visibility buttons in SceneManager are clicked on.

Parameters
visibilityTrue if the prefabs should be made visible. Otherwise, they should be made invisible.

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

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_UnityNavigation, and AC.NavigationEngine_meshCollider.

Member Data Documentation

bool AC.NavigationEngine.is2D = false

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