C# Class SparrowSharp.Utils.Juggler

The Juggler takes objects that implement IAnimatable (e.g. 'MovieClip's) and executes them. A juggler is a simple object. It does no more than saving a list of objects implementing 'Animatable' and advancing their time if it is told to do so (by calling its own 'AdvanceTime' method). Furthermore, an object can request to be removed from the juggler by dispatching an 'RemoveFromJuggler' event. There is a default juggler that you can access from anywhere with the following code: Juggler juggler = SparrowSharpApp.DefaultJuggler; You can, however, create juggler objects yourself, too. That way, you can group your game into logical components that handle their animations independently. A cool feature of the juggler is to delay method calls. Say you want to remove an object from its parent 2 seconds from now. Call: juggler.DelayInvocationAtTarget(object.RemoveFromParent, 2.0f); This line of code will execute the following method 2 seconds in the future: object.RemoveFromParent(); Alternatively, you can use the block-based verson of the method: juggler.DelayInvocationByTime(delegate{ object.RemoveFromParent(); }, 2.0f);
Inheritance: IAnimatable
Afficher le fichier Open project: fmotagarcia/sparrow-sharp Class Usage Examples

Méthodes publiques

Méthode Description
Add ( IAnimatable animatable ) : void

Adds an object to the juggler.

AdvanceTime ( float seconds ) : void
Contains ( IAnimatable animatable ) : bool

Determines if an object has been added to the juggler.

DelayInvocationOf ( IAnimatable animatable, float time ) : object

Delays the execution of a certain method. Returns a proxy object on which to call the method instead. Execution will be delayed until 'time' has passed.

Remove ( IAnimatable animatable ) : void

Removes an object from the juggler.

RemoveAll ( ) : void

Removes all objects at once.

Method Details

Add() public méthode

Adds an object to the juggler.
public Add ( IAnimatable animatable ) : void
animatable IAnimatable
Résultat void

AdvanceTime() public méthode

public AdvanceTime ( float seconds ) : void
seconds float
Résultat void

Contains() public méthode

Determines if an object has been added to the juggler.
public Contains ( IAnimatable animatable ) : bool
animatable IAnimatable
Résultat bool

DelayInvocationOf() public méthode

Delays the execution of a certain method. Returns a proxy object on which to call the method instead. Execution will be delayed until 'time' has passed.
public DelayInvocationOf ( IAnimatable animatable, float time ) : object
animatable IAnimatable
time float
Résultat object

Remove() public méthode

Removes an object from the juggler.
public Remove ( IAnimatable animatable ) : void
animatable IAnimatable
Résultat void

RemoveAll() public méthode

Removes all objects at once.
public RemoveAll ( ) : void
Résultat void