created interface to implement for UserInputManager

This commit is contained in:
Hanusiak Piotr 2022-01-17 11:16:42 +01:00
parent b1cad1e5d3
commit 173d10738d
4 changed files with 90 additions and 44 deletions

View file

@ -0,0 +1,25 @@
import type { UserInputHandlerInterface } from "../../Interfaces/UserInputHandlerInterface";
import type { GameScene } from "../Game/GameScene";
export class GameSceneUserInputHandler implements UserInputHandlerInterface {
private gameScene: GameScene;
constructor(gameScene: GameScene) {
this.gameScene = gameScene;
}
public handleMouseWheelEvent(
pointer: Phaser.Input.Pointer,
gameObjects: Phaser.GameObjects.GameObject[],
deltaX: number,
deltaY: number,
deltaZ: number
): void {
this.gameScene.zoomByFactor(1 - (deltaY / 53) * 0.1);
}
public handleSpaceKeyUpEvent(event: Event): Event {
this.gameScene.activateOutlinedItem();
return event;
}
}