How should AIController interact with its Pawn?

Hi, I’m just beginning with UE4 and I can’t get a handle of Controllers.
I omitted PlayerController, doing all the logic for my simple game in the one and only Player Pawn, but now I need to create enemies and I don’t really know how it SHOULD be done. My idea was to create an AIController that will set a basic logic for all enemies to follow and create more complex implementations within the AI Pawn classes. So, let’s set an example, the AIController has a Shoot() function that is called every once in a while (based on a time variable inside its possessed Pawn) that does nothing more than call the respective Shoot() function in its possessed Pawn. The problem is that this single AIController will be possessing dozen of different Pawn inherited classes. My questions are:
1.) How do I access the possessed Pawn as it’s actual class rather than just APawn (that is returned by GetControlledPawn()),
2.) Is this the way Controllers and Pawns should be used or should I set the dependencies totally differently?

Also, I want this project to be as “Cplusplussy” as it can get, so please give me a solution that doesn’t depend a lot on Blueprints.

  1. You can use Cast<AYourOwnPawnClass>(YourPawnReference); This returns a pointer to the class you cast it to, and nullptr if it doesn’t succeed. Naturally, this means you’ll have to if-else your way down to the pawn class you’re looking to find.
    A cleaner solution would be to have all your different implementations of pawn inherit from another pawn base class, which contains all the virtual functions your pawns use, and have their implementations overridden and defined in the pawn subclasses.
    This way you don’t have to worry which type your pawn reference is, just call the function on the same “mother-pawnclass” and the function will be called on the pawn class that overrides it.
    You can access this class by simply overriding “GetControlledPawn()” in your AIController, and make it - instead of APawn* - return this “AMotherPawn*” class.

  2. I have absolutely no idea ._.