Add animations messages
This commit is contained in:
parent
70a9359c7f
commit
e7221390f3
3 changed files with 37 additions and 0 deletions
18
src/view/animation-renderer.tsx
Executable file
18
src/view/animation-renderer.tsx
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
import { PlayerConnection } from '../player-connection';
|
||||
import { GameServer } from '../game-server';
|
||||
|
||||
export function broadcastAnimation(server: GameServer, animation: string) {
|
||||
server.connections.forEach((conn: PlayerConnection) =>
|
||||
broadcastAnimationToPlayer(conn, animation),
|
||||
);
|
||||
}
|
||||
|
||||
export function broadcastAnimationToPlayer(
|
||||
conn: PlayerConnection,
|
||||
animation: string,
|
||||
) {
|
||||
conn.ws.send({
|
||||
type: 'animation',
|
||||
animation: animation,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue