
1.引入URP 2.引入InputSystem 3.引入Fungus 4.引入DoTween 5.引入CinemaMachine 6.引入BehaviorTree 7.引入BehaviorTree动作包 8.配置了渲染管线资源 🥵🥵🥵🥵🥵
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using UnityEngine;
|
|
|
|
namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector2
|
|
{
|
|
[TaskCategory("Unity/Vector2")]
|
|
[TaskDescription("Move from the current position to the target position.")]
|
|
public class MoveTowards : Action
|
|
{
|
|
[Tooltip("The current position")]
|
|
public SharedVector2 currentPosition;
|
|
[Tooltip("The target position")]
|
|
public SharedVector2 targetPosition;
|
|
[Tooltip("The movement speed")]
|
|
public SharedFloat speed;
|
|
[Tooltip("The move resut")]
|
|
[RequiredField]
|
|
public SharedVector2 storeResult;
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
storeResult.Value = Vector2.MoveTowards(currentPosition.Value, targetPosition.Value, speed.Value * Time.deltaTime);
|
|
return TaskStatus.Success;
|
|
}
|
|
|
|
public override void OnReset()
|
|
{
|
|
currentPosition = Vector2.zero;
|
|
targetPosition = Vector2.zero;
|
|
storeResult = Vector2.zero;
|
|
speed = 0;
|
|
}
|
|
}
|
|
} |