GrillMaster
Member
This new version of the AnimatedInteractable script uses the State system to accept string inputs to drive Animator parameters - this allows for greater animator flexibility since we are no longer restricted to only bools or toggles. If your Animator doesn't contain a parameter that matches with a set State, the State will still take effect but the Animator will do nothing in particular. Most importantly, we no longer need to use multiple AnimatedInteractable scripts just to perform single actions inside the Animator - this singular script can handle any number of Interactions. I designed this primarily to be a general multi-input animator router, with a particular bent towards puzzles or multi-selector interfaces.
For the Animator Parameters, we have a number of options available for tuning (either as default behaviors or using the state system to modify during runtime); our Trigger Parameter doesn't have any particular settings attached to it, we simply enable and then disable.
For Booleans, we have Toggle, Switch, and Exclusive - bools are able to influence other bools.
Toggle - will only modify the bool parameter associated with the State.
Switch - if any bool parameter is on, turn all bools off - if no bools are active, turn this bool on.
Exclusive - if any bool parameter is on, turn all bools off, then turn this bool on.
For Floats, we have Exclusive, Additive, and Invertive - floats are able to influence other floats.
Exclusive - all other float channels will be blended to zero while this float is blended to 1.
Additive - only this float channel will blend, 0->1 for enable, 1->0 for disable.
Invertive - all other float channels will be blended to the opposite value of this channel, 0->1 for enable all others disabled, 1->0 for disable all others enabled.
For Integers, we have Counter, ResetCounter, and Absolute - integers at the moment do not influence other integers.
Counter - this int parameter will increment by 1 up to the max allowed value m_TargetValue.
ResetCounter - this int parameter will increment by 1 up to the max allowed m_TargetValue, then reset to zero on the next increment.
Absolute - this int parameter will be set to the current m_TargetValue.
We are also now tying our effects to ImpactModuleGroups and ImpactModuleGroupObjects - we are supplied with a default EnableGroup and DisableGroup -> these effects will be applied anytime a State-tied parameter is enabled and disabled, according to the State that set them in the first place -> you can override these effects using the ImpactModuleGroupObjects in cases where a particular state triggers failure conditions that damage the player / environment. I'm afraid at the moment only the EnableGroup and DisableGroup can send events, so I would make sure that these default actions are your intended "success / failure" branches, while your override groups can be for other effects.
I have also included AnimationEventTriggers so you can time your effects appropriately for each branch. There are some additional settings available like the Enable/Disable Messages, and a bool that will allow for Looping Effects -> if your animation loops and has an event that will trigger an ImpactActionGroup, you can choose whether or not you want it to only happen once or repeatedly. If you disable the bool and set the duration to less than zero (-1), then the effect will never fire.
When creating the controls for your script, make sure the names of the States matches with the Parameter names inside the Animator component - these will be hashed at runtime for quick lookups so we can enable / disable those particular parameters as described by our earlier rules.
I think this can be a strong drop-in change @Justin, please let me know if there's anything missing here.
For the Animator Parameters, we have a number of options available for tuning (either as default behaviors or using the state system to modify during runtime); our Trigger Parameter doesn't have any particular settings attached to it, we simply enable and then disable.
For Booleans, we have Toggle, Switch, and Exclusive - bools are able to influence other bools.
Toggle - will only modify the bool parameter associated with the State.
Switch - if any bool parameter is on, turn all bools off - if no bools are active, turn this bool on.
Exclusive - if any bool parameter is on, turn all bools off, then turn this bool on.
For Floats, we have Exclusive, Additive, and Invertive - floats are able to influence other floats.
Exclusive - all other float channels will be blended to zero while this float is blended to 1.
Additive - only this float channel will blend, 0->1 for enable, 1->0 for disable.
Invertive - all other float channels will be blended to the opposite value of this channel, 0->1 for enable all others disabled, 1->0 for disable all others enabled.
For Integers, we have Counter, ResetCounter, and Absolute - integers at the moment do not influence other integers.
Counter - this int parameter will increment by 1 up to the max allowed value m_TargetValue.
ResetCounter - this int parameter will increment by 1 up to the max allowed m_TargetValue, then reset to zero on the next increment.
Absolute - this int parameter will be set to the current m_TargetValue.
We are also now tying our effects to ImpactModuleGroups and ImpactModuleGroupObjects - we are supplied with a default EnableGroup and DisableGroup -> these effects will be applied anytime a State-tied parameter is enabled and disabled, according to the State that set them in the first place -> you can override these effects using the ImpactModuleGroupObjects in cases where a particular state triggers failure conditions that damage the player / environment. I'm afraid at the moment only the EnableGroup and DisableGroup can send events, so I would make sure that these default actions are your intended "success / failure" branches, while your override groups can be for other effects.
I have also included AnimationEventTriggers so you can time your effects appropriately for each branch. There are some additional settings available like the Enable/Disable Messages, and a bool that will allow for Looping Effects -> if your animation loops and has an event that will trigger an ImpactActionGroup, you can choose whether or not you want it to only happen once or repeatedly. If you disable the bool and set the duration to less than zero (-1), then the effect will never fire.
When creating the controls for your script, make sure the names of the States matches with the Parameter names inside the Animator component - these will be hashed at runtime for quick lookups so we can enable / disable those particular parameters as described by our earlier rules.

I think this can be a strong drop-in change @Justin, please let me know if there's anything missing here.
Attachments
Last edited: