protected override void HandleMsg(EPhotonMsg pReceivedMsg, object[] pParams, ByteBuffer bb) { //Debug.Log($"Game HandleMsg {pReceivedMsg}"); switch (pReceivedMsg) { case EPhotonMsg.Game_PlayerLoadedScene: if (!PhotonNetwork.IsMasterClient) { Debug.LogError("Only master should receive PlayerLoadedScene"); return; } PhotonPlayer player = PhotonNetwork.CurrentRoom.GetPlayer((int)pParams[0]); Debug.Log(player + " loaded game"); game.PlayerManager.OnRemotePlayerLoadedScene(player); break; //case EPhotonMsg.Game_Activate: // game.Activate(); // break; case EPhotonMsg.Game_Ui_ShowTimeValue: int timeValue = (int)pParams[0]; game.UIGameTime.ShowTimeValue(timeValue); break; case EPhotonMsg.Game_UpdatePlayerScore: int playerNumber = (int)pParams[0]; int kills = (int)pParams[1]; int deaths = (int)pParams[2]; game.Results.UpdatePlayerScore(playerNumber, kills, deaths); break; case EPhotonMsg.Game_EndGame: GameResultInfoS infoS = GameResultInfoS.GetRootAsGameResultInfoS(bb); GameResultInfo gameResultInfo = GameResultInfo.Deserialize(infoS); Debug.Log("Game_SetGameResultInfo"); Debug.Log(gameResultInfo); game.GameEnd.OnReceiveEndGame(gameResultInfo); break; case EPhotonMsg.Game_Lighting_SetMode: bool night = (bool)pParams[0]; game.Lighting.SetMode(night); break; case EPhotonMsg.Game_HandleEffect: EGameEffect effect = (EGameEffect)pParams[0]; game.GameEffect.HandleEffect(effect); break; default: Debug.LogError("Message not handled"); break; } }
internal void HandleEffect(EGameEffect pType) { //game effects are handled only on master side if (!brainiacs.PhotonManager.IsMaster()) { game.Photon.Send(EPhotonMsg.Game_HandleEffect, pType); return; } switch (pType) { case EGameEffect.None: break; case EGameEffect.Night: game.Lighting.SetNight(5); break; default: break; } }
internal GameEffectConfig GetGameEffectConfig(EGameEffect pGameEffect) { return(GameEffects.Find(a => a.Type == pGameEffect)); }