Roman aa6e1ebe90 任务:创建项目,引入部分将会用到的插件和包
1.引入URP
2.引入InputSystem
3.引入Fungus
4.引入DoTween
5.引入CinemaMachine
6.引入BehaviorTree
7.引入BehaviorTree动作包
8.配置了渲染管线资源

🥵🥵🥵🥵🥵
2021-11-21 15:14:51 +08:00

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;
}
}
}