[client] use class provide macro
This commit is contained in:
34
src/client/haxe/ru/m/animate/AnimateManager.hx
Normal file
34
src/client/haxe/ru/m/animate/AnimateManager.hx
Normal file
@@ -0,0 +1,34 @@
|
||||
package ru.m.animate;
|
||||
|
||||
@:provide class AnimateManager {
|
||||
public var playing(default, default):Bool;
|
||||
|
||||
private var timer:Timer;
|
||||
private var animations:Array<Animate>;
|
||||
|
||||
public function new() {
|
||||
animations = [];
|
||||
timer = new Timer(30);
|
||||
timer.run = update;
|
||||
}
|
||||
|
||||
public function update():Void {
|
||||
if (playing) {
|
||||
for (animation in animations) {
|
||||
if (animation.playing) {
|
||||
animation.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function add(animate:Animate):Void {
|
||||
animations.push(animate);
|
||||
}
|
||||
|
||||
public function remove(animate:Animate):Void {
|
||||
if (animations.indexOf(animate) > -1) {
|
||||
animations.remove(animate);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user