C# Class SpriteBase, urban-survivors

Inheritance: SpriteRoot, ISpriteAnimatable
Mostra file Open project: exdev/urban-survivors Class Usage Examples

Public Properties

Property Type Description
defaultAnim int
playAnimOnStart bool

Protected Properties

Property Type Description
animCompleteDelegate AnimCompleteDelegate
animFrameDelegate AnimFrameDelegate
animating bool
curAnimIndex int
framesToAdvance int
timeBetweenAnimFrames float
timeSinceLastFrame float

Public Methods

Method Description
AddSpriteResizedDelegate ( SpriteResizedDelegate del ) : void

Adds the delegate to be called when the sprite is resized.

Clear ( ) : void

Resets important sprite values to defaults for reuse.

Copy ( SpriteRoot, s ) : void
Delete ( ) : void
Hide ( bool tf ) : void
IsAnimating ( ) : bool

Returns whether the sprite is currently animating.

PauseAnim ( ) : void

Pauses the currently-playing animation.

PlayAnim ( int index ) : void
PlayAnim ( string name ) : void
PlayAnimInReverse ( int index ) : void
PlayAnimInReverse ( string name ) : void
RemoveSpriteresizedDelegate ( SpriteResizedDelegate del ) : void

Removes the specified delegate from the list of those to be called when the sprite is resized.

RevertToStatic ( ) : void

Reverts the sprite to its static (non-animating) default appearance.

SetAnimCompleteDelegate ( AnimCompleteDelegate del ) : void

Sets the delegate to be called upon animation completion.

SetAnimFrameDelegate ( AnimFrameDelegate del ) : void

Sets the delegate to be called each frame of animation.

SetFramerate ( float fps ) : void

Changes the framerate at which the current animation plays. NOTE: This only has effect if called AFTER PlayAnim() is called. Otherwise, PlayAnim() sets the framerate to whatever is specified in the animation itself.

SetSpriteResizedDelegate ( SpriteResizedDelegate del ) : void

Sets the delegate to be called when the sprite is resized.

StepAnim ( float time ) : bool
StopAnim ( ) : void

Stops the current animation from playing and resets it to the beginning for playing again. The sprite then reverts to the static image.

Protected Methods

Method Description
AddToAnimatedList ( ) : void
Awake ( ) : void
OnDisable ( ) : void
OnEnable ( ) : void
RemoveFromAnimatedList ( ) : void

Method Details

AddSpriteResizedDelegate() public method

Adds the delegate to be called when the sprite is resized.
public AddSpriteResizedDelegate ( SpriteResizedDelegate del ) : void
del SpriteResizedDelegate A delegate to be called when the sprite is resized.
return void

AddToAnimatedList() protected method

protected AddToAnimatedList ( ) : void
return void

Awake() protected method

protected Awake ( ) : void
return void

Clear() public method

Resets important sprite values to defaults for reuse.
public Clear ( ) : void
return void

Copy() public method

public Copy ( SpriteRoot, s ) : void
s SpriteRoot,
return void

Delete() public method

public Delete ( ) : void
return void

Hide() public method

public Hide ( bool tf ) : void
tf bool
return void

IsAnimating() public method

Returns whether the sprite is currently animating.
public IsAnimating ( ) : bool
return bool

OnDisable() protected method

protected OnDisable ( ) : void
return void

OnEnable() protected method

protected OnEnable ( ) : void
return void

PauseAnim() public method

Pauses the currently-playing animation.
public PauseAnim ( ) : void
return void

PlayAnim() public method

public PlayAnim ( int index ) : void
index int
return void

PlayAnim() public method

public PlayAnim ( string name ) : void
name string
return void

PlayAnimInReverse() public method

public PlayAnimInReverse ( int index ) : void
index int
return void

PlayAnimInReverse() public method

public PlayAnimInReverse ( string name ) : void
name string
return void

RemoveFromAnimatedList() protected method

protected RemoveFromAnimatedList ( ) : void
return void

RemoveSpriteresizedDelegate() public method

Removes the specified delegate from the list of those to be called when the sprite is resized.
public RemoveSpriteresizedDelegate ( SpriteResizedDelegate del ) : void
del SpriteResizedDelegate The delegate to be removed.
return void

RevertToStatic() public method

Reverts the sprite to its static (non-animating) default appearance.
public RevertToStatic ( ) : void
return void

SetAnimCompleteDelegate() public method

Sets the delegate to be called upon animation completion.
public SetAnimCompleteDelegate ( AnimCompleteDelegate del ) : void
del AnimCompleteDelegate The delegate to be called when an animation finishes playing.
return void

SetAnimFrameDelegate() public method

Sets the delegate to be called each frame of animation.
public SetAnimFrameDelegate ( AnimFrameDelegate del ) : void
del AnimFrameDelegate The delegate to be called each frame of animation.
return void

SetFramerate() public method

Changes the framerate at which the current animation plays. NOTE: This only has effect if called AFTER PlayAnim() is called. Otherwise, PlayAnim() sets the framerate to whatever is specified in the animation itself.
public SetFramerate ( float fps ) : void
fps float The new framerate, in frames per second.
return void

SetSpriteResizedDelegate() public method

Sets the delegate to be called when the sprite is resized.
public SetSpriteResizedDelegate ( SpriteResizedDelegate del ) : void
del SpriteResizedDelegate The delegate to be called when the sprite is resized.
return void

StepAnim() public method

public StepAnim ( float time ) : bool
time float
return bool

StopAnim() public method

Stops the current animation from playing and resets it to the beginning for playing again. The sprite then reverts to the static image.
public StopAnim ( ) : void
return void

Property Details

animCompleteDelegate protected_oe property

protected AnimCompleteDelegate animCompleteDelegate
return AnimCompleteDelegate

animFrameDelegate protected_oe property

protected AnimFrameDelegate animFrameDelegate
return AnimFrameDelegate

animating protected_oe property

protected bool animating
return bool

curAnimIndex protected_oe property

protected int curAnimIndex
return int

defaultAnim public_oe property

Index of the animation to play by default.
public int defaultAnim
return int

framesToAdvance protected_oe property

protected int framesToAdvance
return int

playAnimOnStart public_oe property

When set to true, the sprite will play the default animation (see defaultAnim) when the sprite is instantiated.
public bool playAnimOnStart
return bool

timeBetweenAnimFrames protected_oe property

protected float timeBetweenAnimFrames
return float

timeSinceLastFrame protected_oe property

protected float timeSinceLastFrame
return float