FlipSpriteAction - CodingDino/Dino-Unity-Toolkit GitHub Wiki

The FlipSpriteAction component flips a sprite to face left or right. This is most commonly used for player or enemy movement, to allow the sprite to face in the correct direction based on movement. By default, sprites are assumed to face right in their source image - however, the invert parameter can be used to indicate they face left instead.

This is an Action component, and therefore must be triggered by a separate Activator component. Actions, Activators, and Data make up the core system for the Dino Unity Toolkit.

Image: FlipSpriteAction attached to the player. The action is triggered by the InputAxisActivator using the ActionSetFlipFloat function to pass the input axis float value to the FlipSpriteAction.

Properties

Property: Description:
Invert If true, actions that would normally set flip true will set it to false, and vice versa.

Actions

This component has several Action functions that can be triggered by Activators.

ActionSetFlipBool()

This action sets the Flip X value of the SpriteRenderer to true or false, based on what is passed in and the invert setting. If true, the sprite will be flipped, and if false, the sprite will be in it's original state. Invert will switch this behaviour.

Parameter: Description:
New Flip The new value for the SpriteRenderer's Flip X value.

ActionSetFlipFloat()

This action sets a sprite's facing based on a float value. Positive or zero values mean the sprite will not be flipped, and negative values means they will be flipped. Invert will swap this behaviour.

Parameter: Description:
Float Flip The float value used to evaluate the flip. Positive or zero means no flip, negative means flip.