
1.引入URP 2.引入InputSystem 3.引入Fungus 4.引入DoTween 5.引入CinemaMachine 6.引入BehaviorTree 7.引入BehaviorTree动作包 8.配置了渲染管线资源 🥵🥵🥵🥵🥵
52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using UnityEngine;
|
|
|
|
namespace BehaviorDesigner.Runtime.Tasks.Movement
|
|
{
|
|
[TaskDescription("Seek the target specified using the Unity NavMesh.")]
|
|
[TaskCategory("Movement")]
|
|
[HelpURL("https://www.opsive.com/support/documentation/behavior-designer-movement-pack/")]
|
|
[TaskIcon("Assets/Behavior Designer Movement/Editor/Icons/{SkinColor}SeekIcon.png")]
|
|
public class Seek : NavMeshMovement
|
|
{
|
|
[Tooltip("The GameObject that the agent is seeking")]
|
|
public SharedGameObject target;
|
|
[Tooltip("If target is null then use the target position")]
|
|
public SharedVector3 targetPosition;
|
|
|
|
public override void OnStart()
|
|
{
|
|
base.OnStart();
|
|
|
|
SetDestination(Target());
|
|
}
|
|
|
|
// Seek the destination. Return success once the agent has reached the destination.
|
|
// Return running if the agent hasn't reached the destination yet
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
if (HasArrived()) {
|
|
return TaskStatus.Success;
|
|
}
|
|
|
|
SetDestination(Target());
|
|
|
|
return TaskStatus.Running;
|
|
}
|
|
|
|
// Return targetPosition if target is null
|
|
private Vector3 Target()
|
|
{
|
|
if (target.Value != null) {
|
|
return target.Value.transform.position;
|
|
}
|
|
return targetPosition.Value;
|
|
}
|
|
|
|
public override void OnReset()
|
|
{
|
|
base.OnReset();
|
|
target = null;
|
|
targetPosition = Vector3.zero;
|
|
}
|
|
}
|
|
} |