Search Results for

    Show / Hide Table of Contents

    Class AgentMovementTask

    Defines movement tasks for walking and running Uses the NavMeshAgent component

    Inheritance
    Object
    BaseTask
    AgentBaseTask
    AgentMovementTask
    Implements
    IAgentTask
    ITask
    ISerializable
    Inherited Members
    AgentBaseTask.DependsOnTasks
    AgentBaseTask.CanStart
    AgentBaseTask.IsFinished
    AgentBaseTask.FinishTask()
    AgentBaseTask.FinishTaskAsFailed()
    AgentBaseTask.WaitFor(AgentBaseTask[])
    BaseTask.State
    BaseTask.StopAsFailed()
    BaseTask.StopAsSucceeded()
    BaseTask.Tick(Agent)
    Namespace: i5.VirtualAgents.AgentTasks
    Assembly: cs.temp.dll.dll
    Syntax
    public class AgentMovementTask : AgentBaseTask, IAgentTask, ITask, ISerializable

    Constructors

    AgentMovementTask()

    Declaration
    public AgentMovementTask()

    AgentMovementTask(GameObject, Single, Boolean)

    Create an AgentMovementTask using a destination object

    Declaration
    public AgentMovementTask(GameObject destinationObject, float targetSpeed = -1F, bool followGameObject = false)
    Parameters
    Type Name Description
    GameObject destinationObject

    The object that the agent should move to or follow

    Single targetSpeed

    The target speed of the agent, e.g. to set running or walking; if not set, the default value in the NavMeshAgent is taken

    Boolean followGameObject

    Determines if the agent should follow the DestinationObject automatically, even when path is noncomplete

    AgentMovementTask(Vector3, Single)

    Create an AgentMovementTask using destination coordinates

    Declaration
    public AgentMovementTask(Vector3 destinationCoordinates, float targetSpeed = -1F)
    Parameters
    Type Name Description
    Vector3 destinationCoordinates

    The position to which the agent should move

    Single targetSpeed

    The target speed of the agent, e.g. to set running or walking; if not set, the default value in the NavMeshAgent is taken

    Fields

    navMeshAgent

    Reference to the NavMeshAgent component

    Declaration
    protected NavMeshAgent navMeshAgent
    Field Value
    Type Description
    NavMeshAgent

    Properties

    Destination

    Destination coordinates of the movement task

    Declaration
    public Vector3 Destination { get; protected set; }
    Property Value
    Type Description
    Vector3

    DestinationObject

    Destination Object of the movement task

    Declaration
    public GameObject DestinationObject { get; protected set; }
    Property Value
    Type Description
    GameObject

    MinDistance

    Minimum distance of the agent to the target so that the task is considered finished

    Declaration
    public float MinDistance { get; set; }
    Property Value
    Type Description
    Single

    PathUpdateInterval

    Number of seconds after which the path will be recalculated

    Declaration
    public float PathUpdateInterval { get; set; }
    Property Value
    Type Description
    Single

    TargetSpeed

    The target movement speed of the agent If negative, the default value set in the NavMeshAgent is taken

    Declaration
    public float TargetSpeed { get; protected set; }
    Property Value
    Type Description
    Single

    Methods

    Deserialize(SerializationDataContainer)

    Declaration
    public void Deserialize(SerializationDataContainer serializer)
    Parameters
    Type Name Description
    SerializationDataContainer serializer

    EvaluateTaskState()

    Checks every frame whether the agent has reached the target

    Declaration
    public override TaskState EvaluateTaskState()
    Returns
    Type Description
    TaskState
    Overrides
    BaseTask.EvaluateTaskState()

    Serialize(SerializationDataContainer)

    Declaration
    public void Serialize(SerializationDataContainer serializer)
    Parameters
    Type Name Description
    SerializationDataContainer serializer

    StartExecution(Agent)

    Starts the movement task

    Declaration
    public override void StartExecution(Agent agent)
    Parameters
    Type Name Description
    Agent agent

    The agent which should execute the movement task

    Overrides
    BaseTask.StartExecution(Agent)

    StopExecution()

    Finish the task

    Declaration
    public override void StopExecution()
    Overrides
    BaseTask.StopExecution()

    Implements

    IAgentTask
    ITask
    ISerializable
    In This Article
    Back to top Documentation of the Virtual Agents Framework