28 lines
677 B
C#
28 lines
677 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using NodeCanvas.Framework;
|
|
using UnityEngine;
|
|
using UnityEngine.AI;
|
|
|
|
namespace Net.Project.B.NodeCanvas
|
|
{
|
|
public class WarpNavMeshAgentTask : ActionTask
|
|
{
|
|
public BBParameter<Transform> Target;
|
|
public BBParameter<Transform> Agent;
|
|
protected override void OnExecute()
|
|
{
|
|
if (Agent.isNull || Agent.value.TryGetComponent<NavMeshAgent>(out var navMeshAgent) is false)
|
|
{
|
|
EndAction(false);
|
|
return;
|
|
}
|
|
|
|
navMeshAgent.Warp(Target.value.position);
|
|
|
|
EndAction(true);
|
|
}
|
|
}
|
|
|
|
}
|