2024-10-14 11:13:08 +00:00
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
2025-02-10 02:13:46 +00:00
|
|
|
using DDD.Npcs.Crews;
|
2024-10-14 11:13:08 +00:00
|
|
|
|
2025-02-10 02:13:46 +00:00
|
|
|
namespace DDD.BehaviorTrees.Actions
|
2024-10-14 11:13:08 +00:00
|
|
|
{
|
2024-10-15 18:01:16 +00:00
|
|
|
[TaskCategory("Custom/Npc/Crew")]
|
2025-02-24 11:55:35 +00:00
|
|
|
public class RingedBell : Action
|
2024-10-14 11:13:08 +00:00
|
|
|
{
|
2024-10-15 18:01:16 +00:00
|
|
|
private Crew _crew;
|
2024-10-14 11:13:08 +00:00
|
|
|
|
|
|
|
public override void OnAwake()
|
|
|
|
{
|
2024-10-15 18:01:16 +00:00
|
|
|
_crew = GetComponent<Crew>();
|
2024-10-14 11:13:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
{
|
2025-02-24 11:55:35 +00:00
|
|
|
_crew.MoveBell();
|
2024-10-14 11:13:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
{
|
2025-02-24 11:55:35 +00:00
|
|
|
if (!_crew.AIMovement.HasReachedDestination()) return TaskStatus.Running;
|
|
|
|
|
|
|
|
if (!_crew.HasReachedBell)
|
2024-10-14 11:13:08 +00:00
|
|
|
{
|
2025-02-24 11:55:35 +00:00
|
|
|
_crew.ReachedBell();
|
|
|
|
return TaskStatus.Running;
|
2024-10-14 11:13:08 +00:00
|
|
|
}
|
2025-02-24 11:55:35 +00:00
|
|
|
|
|
|
|
return !_crew.IsRingedBell ? TaskStatus.Success : TaskStatus.Running;
|
2024-10-14 11:13:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|