CapersProject/Assets/02.Scripts/DDD/BehaviorTree/Npc/Crew/Action/IsCompletedMission.cs

26 lines
678 B
C#
Raw Normal View History

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")]
2024-10-22 12:41:31 +00:00
public class IsCompletedMission : 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 TaskStatus OnUpdate()
{
2024-10-31 05:41:13 +00:00
if (_crew.CrewInteraction != null)
{
return _crew.CrewInteraction.CanInteractionCrew() ? TaskStatus.Running : TaskStatus.Failure;
}
return _crew.IsCompletedMission() ? TaskStatus.Success : TaskStatus.Failure;
2024-10-14 11:13:08 +00:00
}
}
}