Camera now show up when someone is moving and hides 5 seconds after we stop moving.

Also, added an animation to show/hide the webcam.
This commit is contained in:
David Négrier 2021-05-20 18:05:03 +02:00
parent 8af8ccd54b
commit d32df13f1b
6 changed files with 146 additions and 10 deletions

View file

@ -2,6 +2,7 @@ import {PlayerAnimationDirections} from "./Animation";
import type {GameScene} from "../Game/GameScene";
import {UserInputEvent, UserInputManager} from "../UserInput/UserInputManager";
import {Character} from "../Entity/Character";
import {userMovingStore} from "../../Stores/GameStore";
import {RadialMenu, RadialMenuClickEvent, RadialMenuItem} from "../Components/RadialMenu";
export const hasMovedEventName = "hasMoved";
@ -86,6 +87,7 @@ export class Player extends Character {
this.previousDirection = direction;
}
this.wasMoving = moving;
userMovingStore.set(moving);
}
public isMoving(): boolean {
@ -99,7 +101,7 @@ export class Player extends Character {
this.openEmoteMenu(emotes);
}
}
isClickable(): boolean {
return true;
}
@ -113,13 +115,13 @@ export class Player extends Character {
this.playEmote(item.name);
});
}
closeEmoteMenu(): void {
if (!this.emoteMenu) return;
this.emoteMenu.destroy();
this.emoteMenu = null;
}
destroy() {
this.scene.events.removeListener('postupdate', this.updateListener);
super.destroy();