C# Class tk2dAnimatedSprite, Malisse

Inheritance: tk2dSprite
Show file Open project: Collegiennes/Malisse Class Usage Examples

Public Properties

Property Type Description
anim tk2dSpriteAnimation,
animationCompleteDelegate AnimationCompleteDelegate
animationEventDelegate AnimationEventDelegate,
clipId int
createCollider bool
playAutomatically bool

Public Methods

Method Description
AddComponent ( GameObject go, tk2dSpriteAnimation, anim, int clipId ) : tk2dAnimatedSprite,

Adds a tk2dAnimatedSprite as a component to the gameObject passed in, setting up necessary parameters and building geometry.

GetClipIdByName ( string name ) : int

Resolves an animation clip by name and returns a unique id. This is a convenient alias to tk2dSpriteAnimation.GetClipIdByName

LateUpdate ( ) : void
OnCompleteAnimation ( ) : void
Pause ( ) : void

Pause the currently playing clip. Will do nothing if the clip is currently paused.

Play ( ) : void

Play the active clip. Will restart the clip if called again. Will restart the clip at clipStartTime if called while the clip is playing.

Play ( float clipStartTime ) : void

Play the active clip, starting "clipStartTime" seconds into the clip. Will restart the clip at clipStartTime if called while the clip is playing.

Play ( int id ) : void

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing.

Play ( int clipId, float clipStartTime ) : void

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing.

Play ( string name ) : void

Play the specified clip. Will restart the clip at clipStartTime if called while the clip is playing.

Play ( string name, float clipStartTime ) : void

Play the specified clip, starting "clipStartTime" seconds into the clip. Will restart the clip at clipStartTime if called while the clip is playing.

Play ( tk2dSpriteAnimationClip, clip, float clipStartTime ) : void

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing.

Play ( tk2dSpriteAnimationClip, clip, float clipStartTime, float overrideFps ) : void

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing. No defaults to play nice with default MonoDevelop configuration.

PlayFromFrame ( int frame ) : void

Play the active clip, starting at the frame specified. Will restart the clip at frame if called while the clip is playing.

PlayFromFrame ( int id, int frame ) : void

Play the clip specified by identifier, starting at the specified frame. Will restart the clip at clipStartTime if called while the clip is playing.

PlayFromFrame ( string name, int frame ) : void

Play the specified clip, starting at the frame specified. Will restart the clip at frame if called while the clip is playing.

ProcessEvents ( int start, int last, int direction ) : void
Resume ( ) : void

Resume the currently paused clip. Will do nothing if the clip hasn't been paused.

SetFrame ( int currFrame ) : void

Sets the current frame. The animation will wrap if the selected frame exceeds the number of frames in the clip. This variant WILL trigger an event if the current frame has a trigger defined.

SetFrame ( int currFrame, bool triggerEvent ) : void

Sets the current frame. The animation will wrap if the selected frame exceeds the number of frames in the clip.

SetFrameInternal ( int currFrame ) : void
Stop ( ) : void

Stop the currently playing clip.

StopAndResetFrame ( ) : void

Stops the currently playing animation and reset to the first frame in the animation

WarpClipToLocalTime ( tk2dSpriteAnimationClip, clip, float time ) : void

Protected Methods

Method Description
NeedBoxCollider ( ) : bool

Private Methods

Method Description
Start ( ) : void
isPlaying ( ) : bool

Method Details

AddComponent() public static method

Adds a tk2dAnimatedSprite as a component to the gameObject passed in, setting up necessary parameters and building geometry.
public static AddComponent ( GameObject go, tk2dSpriteAnimation, anim, int clipId ) : tk2dAnimatedSprite,
go GameObject
anim tk2dSpriteAnimation,
clipId int
return tk2dAnimatedSprite,

GetClipIdByName() public method

Resolves an animation clip by name and returns a unique id. This is a convenient alias to tk2dSpriteAnimation.GetClipIdByName
public GetClipIdByName ( string name ) : int
name string Case sensitive clip name, as defined in .
return int

LateUpdate() public method

public LateUpdate ( ) : void
return void

NeedBoxCollider() protected method

protected NeedBoxCollider ( ) : bool
return bool

OnCompleteAnimation() public method

public OnCompleteAnimation ( ) : void
return void

Pause() public method

Pause the currently playing clip. Will do nothing if the clip is currently paused.
public Pause ( ) : void
return void

Play() public method

Play the active clip. Will restart the clip if called again. Will restart the clip at clipStartTime if called while the clip is playing.
public Play ( ) : void
return void

Play() public method

Play the active clip, starting "clipStartTime" seconds into the clip. Will restart the clip at clipStartTime if called while the clip is playing.
public Play ( float clipStartTime ) : void
clipStartTime float
return void

Play() public method

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing.
public Play ( int id ) : void
id int /// Use to resolve a named clip id ///
return void

Play() public method

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing.
public Play ( int clipId, float clipStartTime ) : void
clipId int
clipStartTime float Clip start time in seconds.
return void

Play() public method

Play the specified clip. Will restart the clip at clipStartTime if called while the clip is playing.
public Play ( string name ) : void
name string /// Name of clip. Try to cache the animation clip Id and use that instead for performance. ///
return void

Play() public method

Play the specified clip, starting "clipStartTime" seconds into the clip. Will restart the clip at clipStartTime if called while the clip is playing.
public Play ( string name, float clipStartTime ) : void
name string Name of clip. Try to cache the animation clip Id and use that instead for performance.
clipStartTime float Clip start time in seconds.
return void

Play() public method

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing.
public Play ( tk2dSpriteAnimationClip, clip, float clipStartTime ) : void
clip tk2dSpriteAnimationClip, The clip to play.
clipStartTime float Clip start time in seconds. A value of DefaultFps will start the clip from the beginning
return void

Play() public method

Play the clip specified by identifier. Will restart the clip at clipStartTime if called while the clip is playing. No defaults to play nice with default MonoDevelop configuration.
public Play ( tk2dSpriteAnimationClip, clip, float clipStartTime, float overrideFps ) : void
clip tk2dSpriteAnimationClip, The clip to play.
clipStartTime float Clip start time in seconds. A value of DefaultFps will start the clip from the beginning
overrideFps float Overriden framerate of clip. Set to 0 to use default
return void

PlayFromFrame() public method

Play the active clip, starting at the frame specified. Will restart the clip at frame if called while the clip is playing.
public PlayFromFrame ( int frame ) : void
frame int
return void

PlayFromFrame() public method

Play the clip specified by identifier, starting at the specified frame. Will restart the clip at clipStartTime if called while the clip is playing.
public PlayFromFrame ( int id, int frame ) : void
id int Use to resolve a named clip id
frame int Frame to start from.
return void

PlayFromFrame() public method

Play the specified clip, starting at the frame specified. Will restart the clip at frame if called while the clip is playing.
public PlayFromFrame ( string name, int frame ) : void
name string Name of clip. Try to cache the animation clip Id and use that instead for performance.
frame int Frame to start playing from.
return void

ProcessEvents() public method

public ProcessEvents ( int start, int last, int direction ) : void
start int
last int
direction int
return void

Resume() public method

Resume the currently paused clip. Will do nothing if the clip hasn't been paused.
public Resume ( ) : void
return void

SetFrame() public method

Sets the current frame. The animation will wrap if the selected frame exceeds the number of frames in the clip. This variant WILL trigger an event if the current frame has a trigger defined.
public SetFrame ( int currFrame ) : void
currFrame int
return void

SetFrame() public method

Sets the current frame. The animation will wrap if the selected frame exceeds the number of frames in the clip.
public SetFrame ( int currFrame, bool triggerEvent ) : void
currFrame int
triggerEvent bool
return void

SetFrameInternal() public method

public SetFrameInternal ( int currFrame ) : void
currFrame int
return void

Stop() public method

Stop the currently playing clip.
public Stop ( ) : void
return void

StopAndResetFrame() public method

Stops the currently playing animation and reset to the first frame in the animation
public StopAndResetFrame ( ) : void
return void

WarpClipToLocalTime() public method

public WarpClipToLocalTime ( tk2dSpriteAnimationClip, clip, float time ) : void
clip tk2dSpriteAnimationClip,
time float
return void

Property Details

anim public property

tk2dSpriteAnimation
public tk2dSpriteAnimation, anim
return tk2dSpriteAnimation,

animationCompleteDelegate public property

Animation complete event. This is called when the animation has completed playing. Will not trigger on looped animations
public AnimationCompleteDelegate animationCompleteDelegate
return AnimationCompleteDelegate

animationEventDelegate public property

Animation event. This is called when the frame displayed has tk2dSpriteAnimationFrame.triggerEvent set. The triggering frame is passed to the delegate, and the eventInfo / Int / Float can be extracted from there.
public AnimationEventDelegate, animationEventDelegate
return AnimationEventDelegate,

clipId public property

Currently playing/active clip
public int clipId
return int

createCollider public property

Interface option to create an animated box collider for this animated sprite
public bool createCollider
return bool

playAutomatically public property

Interface option to play the animation automatically when instantiated / game is started. Useful for background looping animations.
public bool playAutomatically
return bool