C# Класс 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);
Наследование: IAnimatable
Показать файл Открыть проект Примеры использования класса

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

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

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

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

Adds an object to the juggler.
public Add ( IAnimatable animatable ) : void
animatable IAnimatable
Результат void

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

public AdvanceTime ( float seconds ) : void
seconds float
Результат void

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

Determines if an object has been added to the juggler.
public Contains ( IAnimatable animatable ) : bool
animatable IAnimatable
Результат bool

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

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

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

Removes an object from the juggler.
public Remove ( IAnimatable animatable ) : void
animatable IAnimatable
Результат void

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

Removes all objects at once.
public RemoveAll ( ) : void
Результат void