Locomotions Cycling

Locomotions Cycling is used to cycle between locomotion combinations, to make different locomotions active. This can include both hand locomotions (such as Boosting or Treading) and prefab locomotions (such as Gravity Zones or Launchers). This works on the premise that all locomotions are objects which can be either enabled or disabled.


Each of the hands on the Player has a Locomotions Cycler:

A Locomotions Cycler will, upon input or when called programmatically, cycle between locomotion combinations (sets of locomotions) which have been defined in its inspector like so:

Drag and drop hand locomotions (or prefab locomotions in the scene) into the appropriate hand's Locomotions Cycler inspector view. This will change the "loadout" of locomotion combinations that may become active.

The player may be allowed to switch between defined interaction styles on the fly, such as Teleportation versus Treading (seen above). Or perhaps the player needs to change Booster jet configurations while using some settings interface:

Another use of Locomotions Cycling is to change between control schemes. You may want to change between trigger-based or touchpad-based Treading, for instance:

Cycling can also be triggered programmatically as needed by game events. Just call one of the public LocomotionsCycler methods.

How cycling works

A number of locomotion combinations can be provided to each Locomotions Cycler. Each Locomotions Cycler will remember its current index, pointing to which which combination is currently active within the array of all combinations. This index starts at 0 by default.

Cycling, then, is the act of incrementing that index (or returning it to 0 once it has reached the end); after cycling the index, the Locomotions Cycler ensures that the locomotions in the combination specified by that index are the ones that are active.

Activating a locomotion combination is a matter of enabling the given locomotion objects in that combination.

So Locomotions Cycling enables the locomotion objects specified by the combination given at the current index, but that's only half the story. The Locomotions Cycler also has to disable the rest of the locomotions it is responsible for managing. To do this, a Locomotions Cycler first disables all the locomotions it manages before enabling the latest combination.

The Locomotions Cyclers automatically manage (and thus will disable) all locomotions that are children of the Player (which includes all hand locomotions), plus any prefab locomotions (such as Gravity Zones or Launchers) which have manually been included in one of the Locomotions Cyclers combinations. That is to say, the only locomotions the Locomotions Cyclers don't manage are those prefab locomotions which the developer has not included in any of the Locomotions Cyclers' combinations.

As a further example, if you have no locomotion combinations set, the Locomotions Cyclers will disable all of the Player's children/hand locomotions at the start:

But you are free to add as many prefab locomotions into the scene as you like without having to include them in the Locomotions Cycling process. For instance, when you have the above setup, you will still find the bunch of Gravity Zones you have put in the scene below to remain enabled:

What this all means is that you should allow the Locomotions Cycler to handle the enablement of the locomotion objects it manages; you shouldn't disable any locomotion objects inside the Player and any prefab locomotions in the scene that are already included in Locomotions Cycling combinations.