wgge 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import AnimationController from "./AnimationController";
|
|
2
|
+
|
|
3
|
+
export default class AnimationDelayController extends AnimationController {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @type FloatValue
|
|
7
|
+
*/
|
|
8
|
+
model;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @type Number
|
|
12
|
+
*/
|
|
13
|
+
duration;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type Number
|
|
17
|
+
*/
|
|
18
|
+
remaining;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @type boolean
|
|
22
|
+
*/
|
|
23
|
+
repeat;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param game GameModel
|
|
28
|
+
* @param model DirtyValue
|
|
29
|
+
* @param duration Number
|
|
30
|
+
* @param repeat boolean
|
|
31
|
+
*/
|
|
32
|
+
constructor(game, model, duration, repeat = false) {
|
|
33
|
+
super(game, model);
|
|
34
|
+
this.model = model;
|
|
35
|
+
this.duration = duration;
|
|
36
|
+
this.remaining = duration;
|
|
37
|
+
this.repeat = repeat;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
updateInternal(delta) {
|
|
41
|
+
this.remaining -= delta;
|
|
42
|
+
if (this.remaining <= 0) {
|
|
43
|
+
if (this.repeat) {
|
|
44
|
+
this.remaining += this.duration;
|
|
45
|
+
}
|
|
46
|
+
this.finished();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|