@remvst/game-navigation-core 1.1.0 → 1.2.0
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.
|
@@ -2,5 +2,11 @@ import { GamePlugin } from "../game/game-plugin";
|
|
|
2
2
|
export declare class TimeKeysGamePlugin extends GamePlugin {
|
|
3
3
|
static readonly key = "time-keys";
|
|
4
4
|
readonly key = "time-keys";
|
|
5
|
+
speedUpFactor: number;
|
|
6
|
+
slowDownFactor: number;
|
|
7
|
+
constructor(options?: {
|
|
8
|
+
speedUpFactor?: number;
|
|
9
|
+
slowDownFactor?: number;
|
|
10
|
+
});
|
|
5
11
|
get timeFactor(): number;
|
|
6
12
|
}
|
|
@@ -4,16 +4,18 @@ exports.TimeKeysGamePlugin = void 0;
|
|
|
4
4
|
const client_inputs_1 = require("@remvst/client-inputs");
|
|
5
5
|
const game_plugin_1 = require("../game/game-plugin");
|
|
6
6
|
class TimeKeysGamePlugin extends game_plugin_1.GamePlugin {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
super();
|
|
9
9
|
this.key = TimeKeysGamePlugin.key;
|
|
10
|
+
this.speedUpFactor = options.speedUpFactor || 10;
|
|
11
|
+
this.slowDownFactor = options.slowDownFactor || 0.25;
|
|
10
12
|
}
|
|
11
13
|
get timeFactor() {
|
|
12
14
|
if (this.game.inputs.keyboard.isDown(client_inputs_1.Keyboard.F)) {
|
|
13
|
-
return
|
|
15
|
+
return this.speedUpFactor;
|
|
14
16
|
}
|
|
15
17
|
else if (this.game.inputs.keyboard.isDown(client_inputs_1.Keyboard.G)) {
|
|
16
|
-
return
|
|
18
|
+
return this.slowDownFactor;
|
|
17
19
|
}
|
|
18
20
|
return 1;
|
|
19
21
|
}
|
package/package.json
CHANGED
|
@@ -6,11 +6,24 @@ export class TimeKeysGamePlugin extends GamePlugin {
|
|
|
6
6
|
static readonly key = 'time-keys';
|
|
7
7
|
readonly key = TimeKeysGamePlugin.key;
|
|
8
8
|
|
|
9
|
+
speedUpFactor: number;
|
|
10
|
+
slowDownFactor: number;
|
|
11
|
+
|
|
12
|
+
constructor(options: {
|
|
13
|
+
speedUpFactor?: number,
|
|
14
|
+
slowDownFactor?: number,
|
|
15
|
+
} = {}) {
|
|
16
|
+
super();
|
|
17
|
+
|
|
18
|
+
this.speedUpFactor = options.speedUpFactor || 10;
|
|
19
|
+
this.slowDownFactor = options.slowDownFactor || 0.25;
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
get timeFactor(): number {
|
|
10
23
|
if (this.game.inputs.keyboard.isDown(Keyboard.F)) {
|
|
11
|
-
return
|
|
24
|
+
return this.speedUpFactor;
|
|
12
25
|
} else if (this.game.inputs.keyboard.isDown(Keyboard.G)) {
|
|
13
|
-
return
|
|
26
|
+
return this.slowDownFactor;
|
|
14
27
|
}
|
|
15
28
|
|
|
16
29
|
return 1;
|