32 lines
750 B
C#
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;
|
|
}
|
|
}
|
|
} |