Conditional Abort not stopping Action

dangoyette

New member
I've just gotten started with Behavior Designer, and I'm not yet clear on how to do things the right way. I'm currently switching out my old state-based AI with Behavior Designer. My problem is how to properly design the behavior to switch between what I'd call "states".

The behavior I'm working on seems pretty simple. It's for a gun turret. The basic idea is, if the player is directly in front of the turret, I shoot the player. If the player is roughly in front, but not exactly lined up, I rotate to aim at the player. Otherwise, I go idle. Here's the behavior as I set it up:

1569971644042.png

The problem is, what happens is that the behavior gets stuck in the "Gun Turret Aim At Player" action. Here's the action:

C#:
        public override TaskStatus OnUpdate()
        {
            TurretRotation.SetTarget(_playerTransform.position);
            return TaskStatus.Running;
        }

My understanding is that the "Can See Target (Narrow)" condition (which is what checks if the player is straight ahead) should be interrupting the
Gun Turret Aim At Player" action, but that never happens. I'm not clear on why. I thought the way it's set up here, everything on the left should be higher priority.
 
Well, for whatever reason, this all seems to be working for me now, though I can't really say why. It used to be the case that the behavior would get stuck in the "Gun Turret Aim at Player" action, but now it's properly aborting that when the player is directly in front of the turret, and it begins firing. So, nevermind my post. Maybe I had some setting configured wrong initially.
 
Top