Why not use only the AIController?

Sure the Mover deals with the movement. But the PlayerController uses it also and doesn’t have different speed for chasing or patrolling. Hence, we have unused logic which overcomplicates the class? Aren’t we coupling the AIController and the Mover too much with this?

I think this is just about preference, you could write and enemy mover script but that would also overcomplicate things because you’ll have two scripts with a lot of functions that are basically the same.

One way to organize the code better would be with a parent class which holds the common methods, but I suggest you follow the course and then use it as a base to create your own thing. Also, refactoring code is a never ending task, it can always be better, don’t get to focused on that, at the end what players want is a functional fun game, not super tidy code.

1 Like

It’s because a class should only have one job, it would be confusing if it was called AIController but it also has a hidden feature that deals with movement.

This topic was automatically closed after 22 hours. New replies are no longer allowed.

Privacy & Terms