Start visio with user colision
When user enter in colision with other colision, webrtc start visio
This commit is contained in:
parent
d7d7be9ed0
commit
707931724f
4 changed files with 20 additions and 16 deletions
|
@ -1,7 +1,7 @@
|
|||
import {GameSceneInterface, GameScene} from "./GameScene";
|
||||
import {ROOM} from "../../Enum/EnvironmentVariable"
|
||||
import {Connexion, ConnexionInterface, ListMessageUserPositionInterface} from "../../Connexion";
|
||||
import {SimplePeer} from "../../WebRtc/SimplePeer";
|
||||
import {SimplePeerInterface, SimplePeer} from "../../WebRtc/SimplePeer";
|
||||
|
||||
export enum StatusGameManagerEnum {
|
||||
IN_PROGRESS = 1,
|
||||
|
@ -13,12 +13,15 @@ export let ConnexionInstance : ConnexionInterface;
|
|||
export interface GameManagerInterface {
|
||||
GameScenes: Array<GameSceneInterface>;
|
||||
status : number;
|
||||
SimplePeer: SimplePeerInterface;
|
||||
createCurrentPlayer() : void;
|
||||
startWebRtc() : void;
|
||||
shareUserPosition(ListMessageUserPosition : ListMessageUserPositionInterface): void;
|
||||
}
|
||||
export class GameManager implements GameManagerInterface {
|
||||
GameScenes: Array<GameSceneInterface> = [];
|
||||
status: number;
|
||||
SimplePeer : SimplePeerInterface;
|
||||
|
||||
constructor() {
|
||||
this.status = StatusGameManagerEnum.IN_PROGRESS;
|
||||
|
@ -29,8 +32,8 @@ export class GameManager implements GameManagerInterface {
|
|||
return ConnexionInstance.createConnexion().then(() => {
|
||||
this.configureGame();
|
||||
/** TODO add loader in the page **/
|
||||
//initialise cam
|
||||
new SimplePeer(ConnexionInstance);
|
||||
//initialise Pear Connexion of game
|
||||
this.SimplePeer = new SimplePeer(ConnexionInstance);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
throw err;
|
||||
|
@ -59,6 +62,10 @@ export class GameManager implements GameManagerInterface {
|
|||
this.status = StatusGameManagerEnum.CURRENT_USER_CREATED;
|
||||
}
|
||||
|
||||
startWebRtc() : void {
|
||||
this.SimplePeer.startWebRtc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Share position in game
|
||||
* @param ListMessageUserPosition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue