Show / Hide Table of Contents

Secondary Behaviour

Secondary Behaviour

In FootstepBehaviour, if you check the "Secondary Behaviour" box, it will display an another set of settings exactly like the original one.

Actually, one FootstepBehaviour is able to hold 2 behaviours! Each time you play without saying anything specific about which behaviour to play, it use the first behaviour by default. This means if you just check this checkbox and not touching your play code at all, nothing would happen.

How to play using the secondary behaviour

When you use FootstepSource to either Interval Play or One-Shot Play, you must give it 4 assets which are : Surface, SurfaceModifier, Stepper, and StepperModifier. They are collected in an argument struct called ResolvingArgs.

Inside that ResolvingArgs has a bool that could select the secondary behaviour instead, which defaults to false. Set it to true to use the secondary behaviour of resolved FootstepBehaviour.

However, if the resolved FootstepBehaviour does not have "Secondary Behaviour" checked, it will be forwarded to the primary behaviour even if it receives an order to use secondary one in ResolvingArgs.

Why would I want to have 2 behaviours?

The real reason this feature exist is because of an another feature called Interval Lifts. But I implemented its "backend" in a more generic way, resulting in this "secondary behaviour" feature.

However, we can still use this feature creatively in an unrelated way to lifts.

It can be thought as the 5th component in the combination. Recall that Surface + SurfaceModifier + Stepper + StepperModifier resolves into FootstepBehaviour. Maximum number of unique combination is multiplication of all unique mentioned assets. Having one last bool means you can add yet another *2 to the combination (which the settings are inside the same FootstepBehaviour asset).

It is up to you what "secondary" means in your game :

  • Your game's core mechanic is to crack and destroy walking surface to continue the stage. You used Surface for each different stage. You have also used SurfaceModifier for when it is raining or not. Now you want different audio behaviour when walking on cracked but not yet destroyed surface. Therefore you decided that primary behaviour is for undamaged surface, and secondary is for soon to be broken surface.
  • Your game has a tiptoe mechanic that could always be performed on every surface in the game, therefore you want to ensure there are unique audio prepared for everything. You used Stepper for characters, and also used StepperModifier for interchangable footwear of that character. "Tiptoe or not" doesn't look appropriate to be in Surface and SurfaceModifier, therefore, you can define primary behaviour as normal walking and secondary behaviour as tiptoeing.
In This Article
Back to top
A Unity plugin by 5argon from Exceed7 Experiments. Problems/suggestions/contact : 5argon@exceed7.com Discord Unity Forum