C# Class Nez.Sprites.SpriteTrail

renders and fades a copy of the Sprite on the same Entity. minDistanceBetweenInstances determines how often a trail sprite is added.
Inheritance: RenderableComponent, IUpdatable
Mostra file Open project: prime31/Nez

Public Properties

Property Type Description
fadeDelay float
fadeDuration float
fadeToColor Color
initialColor Color
minDistanceBetweenInstances float

Public Methods

Method Description
SpriteTrail ( Sprite sprite, int maxInstances = 15 ) : System
disableSpriteTrail ( bool completeCurrentTrail = true ) : void

disables the SpriteTrail optionally waiting for the current trail to fade out first

enableSpriteTrail ( ) : SpriteTrail

enables the SpriteTrail

render ( Graphics graphics, Camera camera ) : void

Private Methods

Method Description
IUpdatable ( ) : void
spawnInstance ( ) : void

stores the last position for distance calculations and spawns a new trail instance if there is one available in the stack

Method Details

SpriteTrail() public method

public SpriteTrail ( Sprite sprite, int maxInstances = 15 ) : System
sprite Sprite
maxInstances int
return System

disableSpriteTrail() public method

disables the SpriteTrail optionally waiting for the current trail to fade out first
public disableSpriteTrail ( bool completeCurrentTrail = true ) : void
completeCurrentTrail bool If set to true complete current trail.
return void

enableSpriteTrail() public method

enables the SpriteTrail
public enableSpriteTrail ( ) : SpriteTrail
return SpriteTrail

render() public method

public render ( Graphics graphics, Camera camera ) : void
graphics Graphics
camera Camera
return void

Property Details

fadeDelay public_oe property

delay before starting the color fade
public float fadeDelay
return float

fadeDuration public_oe property

total duration of the fade from initialColor to fadeToColor
public float fadeDuration
return float

fadeToColor public_oe property

final color that will be lerped to over the course of fadeDuration
public Color fadeToColor
return Color

initialColor public_oe property

initial color of the trail instances
public Color initialColor
return Color

minDistanceBetweenInstances public_oe property

how far does the Sprite have to move before a new instance is spawned
public float minDistanceBetweenInstances
return float