The platform/motor pairs for platforms execute a simple concept.
- Motors move or handle low level operations of a platform.
- Controllers deal with logic and tell the motor when and where to move (if required).
Motors control the physical movement in the game world as well as interaction with other entities. The motor will move other objects that are sat on top the platform while it is moving, as well as take care of other behind the scenes details such as patrol paths.
Controllers usually contain some extra trigger/activation logic to control if/when a motor can function. SwitchOnPlayerJump
for example tells a platform to cycle to the next waypoint whenever the player jumps. This functions with any attached platform inheriting from PatrollingPlatform
. Controllers leverage the Unity component model to be able to control multiple types of motor as long as they have a common point of inheritance.
There are around 12 different platform types made up of 2 Motors and 4 or so Controllers, the various combinations of these platforms result in some interesting mechanics.