Hey there I am trying to use photon in babylon but getting this error, that Photon is not defined.
here is my code snippet
export class PhotonManager extends BABYLON.ScriptComponent {
// Example: private helloWorld:string = "Hello World";
private client:Photon.LoadBalancing.LoadBalancingClient;
protected awake(): void {
/* Init component function */
}
protected ready(): void {
this.InitPhoton();
}
private InitPhoton(){
this.client = new Photon.LoadBalancing.LoadBalancingClient(Photon.ConnectionProtocol.Ws, APPID, "0");
this.setAllCallBacks();
let connectBoolean = this.client.connect();
console.log("Log Of Connet :- " + connectBoolean);
}
private setAllCallBacks(){
this.client.onStateChange = this.stateChanged;
this.client.onActorJoin = this.actorJoined;
this.client.onActorLeave = this.actorLeft;
this.client.onJoinRoom = this.joinedRoom;
}
private stateChanged(stateNumber: number): void {
console.log("State Changed :- " + stateNumber);
}
private actorJoined (actor: Photon.LoadBalancing.Actor): void{
console.log("Actor Joined :- " + actor.name);
}
private actorLeft (actor: Photon.LoadBalancing.Actor, cleanUp: boolean): void{
console.log("Actor Left :- " + actor.name + " cleanUp :- " + cleanUp);
}
private joinedRoom(createdByMe: boolean): void{
console.log("Joined Room :- " + createdByMe);
}
}