C# Класс SpriteBase, urban-survivors

Наследование: SpriteRoot, ISpriteAnimatable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
defaultAnim int
playAnimOnStart bool

Защищенные свойства (Protected)

Свойство Тип Описание
animCompleteDelegate AnimCompleteDelegate
animFrameDelegate AnimFrameDelegate
animating bool
curAnimIndex int
framesToAdvance int
timeBetweenAnimFrames float
timeSinceLastFrame float

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
AddToAnimatedList ( ) : void
Awake ( ) : void
OnDisable ( ) : void
OnEnable ( ) : void
RemoveFromAnimatedList ( ) : void

Описание методов

AddSpriteResizedDelegate() публичный Метод

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.
Результат void

AddToAnimatedList() защищенный Метод

protected AddToAnimatedList ( ) : void
Результат void

Awake() защищенный Метод

protected Awake ( ) : void
Результат void

Clear() публичный Метод

Resets important sprite values to defaults for reuse.
public Clear ( ) : void
Результат void

Copy() публичный Метод

public Copy ( SpriteRoot, s ) : void
s SpriteRoot,
Результат void

Delete() публичный Метод

public Delete ( ) : void
Результат void

Hide() публичный Метод

public Hide ( bool tf ) : void
tf bool
Результат void

IsAnimating() публичный Метод

Returns whether the sprite is currently animating.
public IsAnimating ( ) : bool
Результат bool

OnDisable() защищенный Метод

protected OnDisable ( ) : void
Результат void

OnEnable() защищенный Метод

protected OnEnable ( ) : void
Результат void

PauseAnim() публичный Метод

Pauses the currently-playing animation.
public PauseAnim ( ) : void
Результат void

PlayAnim() публичный Метод

public PlayAnim ( int index ) : void
index int
Результат void

PlayAnim() публичный Метод

public PlayAnim ( string name ) : void
name string
Результат void

PlayAnimInReverse() публичный Метод

public PlayAnimInReverse ( int index ) : void
index int
Результат void

PlayAnimInReverse() публичный Метод

public PlayAnimInReverse ( string name ) : void
name string
Результат void

RemoveFromAnimatedList() защищенный Метод

protected RemoveFromAnimatedList ( ) : void
Результат void

RemoveSpriteresizedDelegate() публичный Метод

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.
Результат void

RevertToStatic() публичный Метод

Reverts the sprite to its static (non-animating) default appearance.
public RevertToStatic ( ) : void
Результат void

SetAnimCompleteDelegate() публичный Метод

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.
Результат void

SetAnimFrameDelegate() публичный Метод

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.
Результат void

SetFramerate() публичный Метод

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.
Результат void

SetSpriteResizedDelegate() публичный Метод

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.
Результат void

StepAnim() публичный Метод

public StepAnim ( float time ) : bool
time float
Результат bool

StopAnim() публичный Метод

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
Результат void

Описание свойств

animCompleteDelegate защищенное свойство

protected AnimCompleteDelegate animCompleteDelegate
Результат AnimCompleteDelegate

animFrameDelegate защищенное свойство

protected AnimFrameDelegate animFrameDelegate
Результат AnimFrameDelegate

animating защищенное свойство

protected bool animating
Результат bool

curAnimIndex защищенное свойство

protected int curAnimIndex
Результат int

defaultAnim публичное свойство

Index of the animation to play by default.
public int defaultAnim
Результат int

framesToAdvance защищенное свойство

protected int framesToAdvance
Результат int

playAnimOnStart публичное свойство

When set to true, the sprite will play the default animation (see defaultAnim) when the sprite is instantiated.
public bool playAnimOnStart
Результат bool

timeBetweenAnimFrames защищенное свойство

protected float timeBetweenAnimFrames
Результат float

timeSinceLastFrame защищенное свойство

protected float timeSinceLastFrame
Результат float