CapersProject/Assets/02.Scripts/BlueWater/BehaviorTree/Npc/Crew/Action/MoveToRandomPositionInRange.cs
2025-02-10 11:13:46 +09:00

32 lines
750 B
C#

using BehaviorDesigner.Runtime.Tasks;
using DDD.Npcs.Crews;
namespace DDD.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew")]
public class MoveToRandomPositionInRange : Action
{
private Crew _crew;
public override void OnAwake()
{
_crew = GetComponent<Crew>();
}
public override void OnStart()
{
_crew.AIMovement.MoveToRandomPositionInRange(10f);
}
public override TaskStatus OnUpdate()
{
if (_crew.AIMovement.HasReachedDestination())
{
_crew.AIMovement.StopMove();
return TaskStatus.Success;
}
return TaskStatus.Running;
}
}
}