using BehaviorDesigner.Runtime.Tasks; using BlueWater.Npcs.Crews; namespace BlueWater.BehaviorTrees.Actions { [TaskCategory("Custom/Npc/Crew")] public class OnMission : Conditional { private Crew _crew; public override void OnAwake() { _crew = GetComponent(); } public override void OnStart() { if (_crew.CrewInteraction != null) { _crew.AIMovement.Move(_crew.CrewInteraction.CenterTransform.position); } } public override TaskStatus OnUpdate() { if (_crew.CrewInteraction == null || !_crew.CrewInteraction.CanInteractionCrew()) { _crew.AIMovement.StopMove(); _crew.ResetMission(); return TaskStatus.Failure; } if (!_crew.CanInteractionPosition()) return TaskStatus.Running; _crew.AIMovement.StopMove(); _crew.CrewInteraction.InteractionCrew(_crew); return TaskStatus.Success; } } }