@@ -6,7 +6,8 @@ class Engine {
6
6
_generateEnemiesIntervalId ;
7
7
_onGameOverCallback ;
8
8
gameEventCallbackMap ;
9
- __defaultAnimationAction = ( enemyMeshes ) => this . updateExistingEnemiesPosition ( enemyMeshes ) ;
9
+ __updateEnemiesDefaultAnimationAction = ( enemyMeshes ) => this . updateExistingEnemiesPosition ( enemyMeshes ) ;
10
+ __handleGamepadButtonsDefaultAnimationAction = ( ) => this . controls . handleGamepadButtons ( ) ;
10
11
11
12
/**
12
13
* @constructor throw dependencies here
@@ -19,7 +20,7 @@ class Engine {
19
20
this . controls = controls ;
20
21
this . raycaster = raycaster ;
21
22
22
- this . viewer . addAnimationAction ( ( ) => this . controls . handleGamepadButtons ( ) ) ;
23
+ this . viewer . addAnimationActions ( this . __handleGamepadButtonsDefaultAnimationAction ) ;
23
24
24
25
this . gameEventCallbackMap = {
25
26
'shot' : ( { clientX, clientY } ) => this . onShot ( { x : clientX , y : clientY } ) ,
@@ -69,7 +70,11 @@ class Engine {
69
70
}
70
71
71
72
play ( ) {
72
- this . viewer . addAnimationAction ( this . __defaultAnimationAction ) ;
73
+ this . viewer . addAnimationActions (
74
+ this . __updateEnemiesDefaultAnimationAction ,
75
+ this . __handleGamepadButtonsDefaultAnimationAction
76
+ ) ;
77
+
73
78
this . _generateEnemiesIntervalId = setInterval (
74
79
( ) => this . generateEnemies ( ) ,
75
80
GENERATE_ENEMIES_INTERVAL_TIME
0 commit comments