using System; using Unity.Behavior; using UnityEngine; namespace ProjectI.Enemies { // M4 has one host-seeded finite sector. No director transport/renewal exists before M6. [Serializable] [NodeDescription(name: "Wait for fixture assignment", story: "Wait with [Context]", category: "ProjectI/Enemies", id: "b2fab616dce84a908c0312acec0b0e02")] public sealed class RequestEnemyAssignmentAction : Unity.Behavior.Action { [SerializeReference] public BlackboardVariable Context; [SerializeReference] public BlackboardVariable Profile; private EnemyActorContext actor; private double until; protected override Status OnStart() { actor = Context?.Value?.Actor; var profile = Profile?.Value; if (actor == null || !actor.IsValid || profile == null || !profile.Valid) return Status.Failure; until = actor.Now + profile.assignmentWaitSeconds; return Status.Running; } protected override Status OnUpdate() => actor != null && actor.IsValid && Context?.Value?.Actor == actor && actor.Now < until ? Status.Running : Status.Failure; // Explicit bounded exhaustion, never manufacture another assignment. protected override void OnEnd() { actor = null; } } }