AI perception to track player/random patrol

I’m creating an AI System for tracking the player or randomly patrolling when the player is not in sight. I’m just experimenting on it. Is this a good way on using the AI perception or you guys know a much efficient way in using it.

Edited: Added picture.

The most efficient way to create AI is using blackboard / eqs. It eliminates the need to cast which is a big thing when it comes down to optimizing. I understand it’s a whole new system to learn but if you are making a big game I recommend using blackboard as it’s better practice.

Thanks for the tip.

here’s an easier way to do this

Thanks for the answer I will look into it.