NavMeshDynamicAgent

Class in ChivalrousGames.Common / Inherits from MonoBehaviour

Description

Creates a NavMesh agent, designed to be used with dynamic NavMesh.

Properties

Agent NavMeshAgent ReadOnly
Gets the navmesh agent. Will be null if not yet initialized or if disabled.
StartPosition Vector3 ReadOnly
Gets the start position. This is set each time the agent is recreated. If there is no agent, then start position is not relevant

Methods

CreateAgent
public void CreateAgent(float samplePositionMaxDistance, int samplePositionAreaMask, AfterAgentCreatedCallback callback);
Parameters
samplePositionMaxDistance float Sample position max distance. When Agent is created, it is placed on the NavMesh using NavMesh.SamplePosition. See NavMesh.SamplePosition for more information.
samplePositionAreaMask int Sample position area mask. When Agent is created, it is placed on the NavMesh using NavMesh.SamplePosition. See NavMesh.SamplePosition for more information.
callback AfterAgentCreatedCallback Callback. Method called after the agent is successfully created.
Description

Creates the agent.

DestroyAgent
public void DestroyAgent();
Description

Destroys the agent.

AfterAgentCreatedCallback
public delegate void AfterAgentCreatedCallback(NavMeshAgent navMeshAgent);
Parameters
navMeshAgent NavMeshAgent The NavMesh Agent that was just sucessfully created.
Description

Callback executed when NavMeshAgent is created. Implement and pass this method to CreateAgent to execute code when the agent is created.