protected BodyProperties GetBodyProperties( MissionPeer missionPeer, BasicCultureObject cultureLimit) { NetworkCommunicator networkPeer = missionPeer.GetNetworkPeer(); if (networkPeer != null) { return(networkPeer.PlayerConnectionInfo.GetParameter <PlayerData>("PlayerData").BodyProperties); } Team team = missionPeer.Team; BasicCharacterObject troopCharacter = MultiplayerClassDivisions.GetMPHeroClasses(cultureLimit).ToList <MultiplayerClassDivisions.MPHeroClass>().GetRandomElement <MultiplayerClassDivisions.MPHeroClass>().TroopCharacter; MatrixFrame spawnFrame = this.SpawnComponent.GetSpawnFrame(team, troopCharacter.HasMount(), true); AgentBuildData agentBuildData = new AgentBuildData(troopCharacter); agentBuildData.Team(team); agentBuildData.InitialFrame(spawnFrame); agentBuildData.TroopOrigin((IAgentOriginBase) new BasicBattleAgentOrigin(troopCharacter)); agentBuildData.EquipmentSeed(this.MissionLobbyComponent.GetRandomFaceSeedForCharacter(troopCharacter)); agentBuildData.ClothingColor1(team.Side == BattleSideEnum.Attacker ? cultureLimit.Color : cultureLimit.ClothAlternativeColor); agentBuildData.ClothingColor2(team.Side == BattleSideEnum.Attacker ? cultureLimit.Color2 : cultureLimit.ClothAlternativeColor2); agentBuildData.IsFemale(troopCharacter.IsFemale); agentBuildData.Equipment(Equipment.GetRandomEquipmentElements(troopCharacter, !(Game.Current.GameType is MultiplayerGame), seed: agentBuildData.AgentEquipmentSeed)); agentBuildData.BodyProperties(BodyProperties.GetRandomBodyProperties(agentBuildData.AgentIsFemale, troopCharacter.GetBodyPropertiesMin(), troopCharacter.GetBodyPropertiesMax(), (int)agentBuildData.AgentOverridenSpawnEquipment.HairCoverType, agentBuildData.AgentEquipmentSeed, troopCharacter.HairTags, troopCharacter.BeardTags, troopCharacter.TattooTags)); return(agentBuildData.AgentBodyProperties); }
private void OnAgentWentInOrRemoved(Agent agent, bool isAgentRemoved) { if (GameNetwork.IsServer) { this._agentTimers.Remove(agent); if (!isAgentRemoved) { MissionPeer missionPeer = agent.MissionPeer; NetworkCommunicator communicator = missionPeer != null?missionPeer.GetNetworkPeer() : (NetworkCommunicator)null; if (communicator != null && !communicator.IsServerPeer) { GameNetwork.BeginModuleEventAsServer(communicator); GameNetwork.WriteMessage((GameNetworkMessage) new SetBoundariesState(false)); GameNetwork.EndModuleEventAsServer(); } } } if (this.Mission.MainAgent != agent) { return; } this._mainAgentLeaveTimer = (MissionTimer)null; Action stopTime = this.StopTime; if (stopTime == null) { return; } stopTime(); }
protected virtual void OnPlayerDies(MissionPeer peer, MissionPeer assistorPeer) { if (assistorPeer != null && assistorPeer.GetNetworkPeer().IsConnectionActive) { GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(assistorPeer.GetNetworkPeer(), (NetworkCommunicator)null, assistorPeer.KillCount, assistorPeer.AssistCount, assistorPeer.DeathCount, assistorPeer.Score)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } ++peer.DeathCount; peer.SpawnTimer.Reset(MBCommon.GetTime(MBCommon.TimeType.Mission), (float)MissionLobbyComponent.GetSpawnPeriodDurationForPeer(peer)); peer.WantsToSpawnAsBot = false; peer.HasSpawnTimerExpired = false; this._missionScoreboardComponent.PlayerPropertiesChanged(peer.GetNetworkPeer()); GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(peer.GetNetworkPeer(), (NetworkCommunicator)null, peer.KillCount, peer.AssistCount, peer.DeathCount, peer.Score)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); }
protected void SpawnEquipmentUpdated(MissionPeer lobbyPeer, Equipment equipment) { if (!GameNetwork.IsServer || lobbyPeer == null || (!this.SpawningBehaviour.CanUpdateSpawnEquipment(lobbyPeer) || !lobbyPeer.HasSpawnedAgentVisuals)) { return; } GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new EquipEquipmentToPeer(lobbyPeer.GetNetworkPeer(), equipment)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); }
protected virtual void OnPlayerKills( MissionPeer killerPeer, Agent killedAgent, MissionPeer assistorPeer) { NetworkCommunicator killedPeer = (NetworkCommunicator)null; if (killedAgent.MissionPeer == null) { NetworkCommunicator networkPeer = GameNetwork.NetworkPeers.SingleOrDefault <NetworkCommunicator>((Func <NetworkCommunicator, bool>)(x => x.GetComponent <MissionPeer>() != null && x.GetComponent <MissionPeer>().ControlledFormation != null && x.GetComponent <MissionPeer>().ControlledFormation == killedAgent.Formation)); if (networkPeer != null) { MissionPeer component = networkPeer.GetComponent <MissionPeer>(); killedPeer = networkPeer; killerPeer.OnKillAnotherPeer(component); } } else { killerPeer.OnKillAnotherPeer(killedAgent.MissionPeer); killedPeer = killedAgent.MissionPeer.GetNetworkPeer(); } if (killerPeer.ControlledAgent.Team.IsEnemyOf(killedAgent.Team)) { killerPeer.Score += this._gameMode.GetScoreForKill(killedAgent); ++killerPeer.KillCount; } else { killerPeer.Score -= this._gameMode.GetScoreForKill(killedAgent); --killerPeer.KillCount; } this._missionScoreboardComponent.PlayerPropertiesChanged(killerPeer.GetNetworkPeer()); GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(killerPeer.GetNetworkPeer(), killedPeer, killerPeer.KillCount, killerPeer.AssistCount, killerPeer.DeathCount, killerPeer.Score)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); }
public void OnBotsControlledChanged( MissionPeer missionPeer, int botAliveCount, int botTotalCount) { missionPeer.BotsUnderControlAlive = botAliveCount; missionPeer.BotsUnderControlTotal = botTotalCount; Action <NetworkCommunicator> controlledChangedEvent = this.OnBotsControlledChangedEvent; if (controlledChangedEvent == null) { return; } controlledChangedEvent(missionPeer.GetNetworkPeer()); }
private bool HandleClientEventCreateBannerForPeer( NetworkCommunicator peer, NetworkMessages.FromClient.CreateBanner message) { MissionMultiplayerGameModeBase missionBehaviour = Mission.Current.GetMissionBehaviour <MissionMultiplayerGameModeBase>(); if (missionBehaviour == null || !missionBehaviour.AllowCustomPlayerBanners()) { return(false); } MissionPeer component = peer.GetComponent <MissionPeer>(); if (component == null) { return(false); } component.Peer.BannerCode = message.BannerCode; MissionLobbyComponent.SyncBannersToAllClients(message.BannerCode, component.GetNetworkPeer()); return(true); }
public void SyncHealthToClients() { if (this.SyncToAllClients && (!this.Agent.IsMount || this.Agent.RiderAgent != null)) { GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new SetAgentHealth(this.Agent, (int)this.Agent.Health)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } else { NetworkCommunicator networkCommunicator; if (!this.Agent.IsMount) { MissionPeer missionPeer = this.Agent.MissionPeer; networkCommunicator = missionPeer != null?missionPeer.GetNetworkPeer() : (NetworkCommunicator)null; } else { Agent riderAgent = this.Agent.RiderAgent; if (riderAgent == null) { networkCommunicator = (NetworkCommunicator)null; } else { MissionPeer missionPeer = riderAgent.MissionPeer; networkCommunicator = missionPeer != null?missionPeer.GetNetworkPeer() : (NetworkCommunicator)null; } } NetworkCommunicator communicator = networkCommunicator; if (communicator == null || communicator.IsServerPeer) { return; } GameNetwork.BeginModuleEventAsServer(communicator); GameNetwork.WriteMessage((GameNetworkMessage) new SetAgentHealth(this.Agent, (int)this.Agent.Health)); GameNetwork.EndModuleEventAsServer(); } }
private void OnAgentWentOut(Agent agent, float startTimeInSeconds) { MissionTimer missionTimer = GameNetwork.IsClient ? MissionTimer.CreateSynchedTimerClient(startTimeInSeconds, 10f) : new MissionTimer(10f); if (GameNetwork.IsServer) { this._agentTimers.Add(agent, missionTimer); MissionPeer missionPeer = agent.MissionPeer; NetworkCommunicator communicator = missionPeer != null?missionPeer.GetNetworkPeer() : (NetworkCommunicator)null; if (communicator != null && !communicator.IsServerPeer) { GameNetwork.BeginModuleEventAsServer(communicator); GameNetwork.WriteMessage((GameNetworkMessage) new SetBoundariesState(true, missionTimer.GetStartTime().NumberOfTicks)); GameNetwork.EndModuleEventAsServer(); } } if (this.Mission.MainAgent != agent) { return; } this._mainAgentLeaveTimer = missionTimer; Action <float, float> startTime = this.StartTime; if (startTime != null) { startTime(10f, 0.0f); } MatrixFrame cameraFrame = Mission.Current.GetCameraFrame(); Vec3 position = cameraFrame.origin + cameraFrame.rotation.u; if (Mission.Current.Mode != MissionMode.Battle) { return; } MBSoundEvent.PlaySound(SoundEvent.GetEventIdFromString("event:/alerts/report/out_of_map"), position); }
protected virtual void OnBotKills(Agent botAgent, Agent killedAgent) { if (botAgent?.Team == null) { return; } if (botAgent.Formation?.PlayerOwner != null) { NetworkCommunicator networkCommunicator1 = GameNetwork.NetworkPeers.SingleOrDefault <NetworkCommunicator>((Func <NetworkCommunicator, bool>)(x => x.GetComponent <MissionPeer>() != null && x.GetComponent <MissionPeer>().ControlledFormation == botAgent.Formation)); if (networkCommunicator1 != null) { MissionPeer component = networkCommunicator1.GetComponent <MissionPeer>(); MissionPeer missionPeer = killedAgent.MissionPeer; NetworkCommunicator networkCommunicator2 = missionPeer != null?missionPeer.GetNetworkPeer() : (NetworkCommunicator)null; if (killedAgent.MissionPeer == null) { NetworkCommunicator networkCommunicator3 = GameNetwork.NetworkPeers.SingleOrDefault <NetworkCommunicator>((Func <NetworkCommunicator, bool>)(x => x.GetComponent <MissionPeer>() != null && x.GetComponent <MissionPeer>().ControlledFormation == killedAgent.Formation)); if (networkCommunicator3 != null) { networkCommunicator2 = networkCommunicator3; component.OnKillAnotherPeer(networkCommunicator2.GetComponent <MissionPeer>()); } } else { component.OnKillAnotherPeer(killedAgent.MissionPeer); } if (botAgent.Team.IsEnemyOf(killedAgent.Team)) { ++component.KillCount; component.Score += this._gameMode.GetScoreForKill(killedAgent); } else { --component.KillCount; component.Score -= this._gameMode.GetScoreForKill(killedAgent); } this._missionScoreboardComponent.PlayerPropertiesChanged(networkCommunicator1); GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(networkCommunicator1, networkCommunicator2, component.KillCount, component.AssistCount, component.DeathCount, component.Score)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } } else { MissionScoreboardComponent.MissionScoreboardSide sideSafe = this._missionScoreboardComponent.GetSideSafe(botAgent.Team.Side); BotData botScores = sideSafe.BotScores; if (botAgent.Team.IsEnemyOf(killedAgent.Team)) { ++botScores.KillCount; } else { --botScores.KillCount; } this._missionScoreboardComponent.BotPropertiesChanged(sideSafe.Side); GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.BotData(sideSafe.Side, botScores.KillCount, botScores.AssistCount, botScores.DeathCount, botScores.AliveCount)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } this._missionScoreboardComponent.BotPropertiesChanged(botAgent.Team.Side); }
public void RemoveAgentVisualsWithVisualIndex( MissionPeer missionPeer, int visualsIndex, bool sync = false) { missionPeer.ClearVisuals(visualsIndex); if (!GameNetwork.IsDedicatedServer && visualsIndex == 0 && !missionPeer.Peer.IsMine) { this._spawnFrameSelectionHelper.FreeSpawnPointFromPlayer(missionPeer.Peer); } if (sync && GameNetwork.IsServerOrRecorder) { GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new RemoveAgentVisualsFromIndexForPeer(missionPeer.GetNetworkPeer(), visualsIndex)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.ExcludeOtherTeamPlayers, missionPeer.GetNetworkPeer()); } if (this.OnMyAgentVisualRemoved != null && missionPeer.IsMine && visualsIndex == 0) { this.OnMyAgentVisualRemoved(); } Debug.Print("Removed visuals.", color: Debug.DebugColor.BrightWhite, debugFilter: 64UL); }
public void EndPoll() { if (this._runningPollAcceptedCount >= (this._runningPoll is MultiplayerPollComponent.KickPlayer || this._runningPoll is MultiplayerPollComponent.BanPlayer ? (int)Math.Ceiling(((double)GameNetwork.NetworkPeerCount - 1.0) / 2.0) : (int)Math.Ceiling((double)GameNetwork.NetworkPeerCount / 2.0))) { if (this._runningPoll is MultiplayerPollComponent.KickPlayer) { MissionPeer component = ((MultiplayerPollComponent.KickPlayer) this._runningPoll).playerPeer.GetComponent <MissionPeer>(); if (component != null) { NetworkCommunicator networkPeer = component.GetNetworkPeer(); DisconnectInfo disconnectInfo = networkPeer.PlayerConnectionInfo.GetParameter <DisconnectInfo>("DisconnectInfo") ?? new DisconnectInfo(); disconnectInfo.Type = DisconnectType.KickedByPoll; networkPeer.PlayerConnectionInfo.AddParameter("DisconnectInfo", (object)disconnectInfo); GameNetwork.AddNetworkPeerToDisconnectAsServer(networkPeer); if (GameNetwork.IsDedicatedServer) { throw new NotImplementedException(); } NetworkMain.GameClient.KickPlayer(component.Peer.Id, false); } } else if (this._runningPoll is MultiplayerPollComponent.BanPlayer) { MissionPeer component = ((MultiplayerPollComponent.BanPlayer) this._runningPoll).playerPeer.GetComponent <MissionPeer>(); if (component != null) { NetworkCommunicator networkPeer = component.GetNetworkPeer(); DisconnectInfo disconnectInfo = networkPeer.PlayerConnectionInfo.GetParameter <DisconnectInfo>("DisconnectInfo") ?? new DisconnectInfo(); disconnectInfo.Type = DisconnectType.BannedByPoll; networkPeer.PlayerConnectionInfo.AddParameter("DisconnectInfo", (object)disconnectInfo); GameNetwork.AddNetworkPeerToDisconnectAsServer(networkPeer); if (GameNetwork.IsClient) { BannedPlayerManagerCustomGameClient.AddBannedPlayer(component.Peer.Id, GameNetwork.IsDedicatedServer ? -1 : Environment.TickCount + 600000); } else if (GameNetwork.IsDedicatedServer) { BannedPlayerManagerCustomGameServer.AddBannedPlayer(component.Peer.Id, component.GetPeer().UserName, GameNetwork.IsDedicatedServer ? -1 : Environment.TickCount + 600000); } if (GameNetwork.IsDedicatedServer) { throw new NotImplementedException(); } NetworkMain.GameClient.KickPlayer(component.Peer.Id, true); } } else if (this._runningPoll is MultiplayerPollComponent.ChangeGame) { MultiplayerPollComponent.ChangeGame runningPoll = (MultiplayerPollComponent.ChangeGame) this._runningPoll; MultiplayerOptions.MultiplayerOptionsAccessMode mode = MultiplayerOptions.MultiplayerOptionsAccessMode.NextMapOptions; MultiplayerOptions.OptionType.GameType.SetValue(runningPoll.GameType, mode); MultiplayerOptions.Instance.OnGameTypeChanged(mode); MultiplayerOptions.OptionType.Map.SetValue(runningPoll.MapName, mode); this._missionLobbyComponent.SetStateEndingAsServer(); } } this._runningPoll = (object)null; this._runningPollStartTime = new int?(); this._runningPollAcceptedCount = 0; this._runningPollRejectedCount = 0; this._runningPollVoted.Clear(); }
private void OnPlayerKilled(MissionPeer killerPeer, MissionPeer killedPeer) { if (killerPeer == null || killedPeer == null || (killerPeer.Peer == null || killedPeer.Peer == null)) { return; } PlayerId id1 = killerPeer.Peer.Id; PlayerId id2 = killedPeer.Peer.Id; if (id1 == this._myId && id2 != this._myId) { RecentPlayersManager.AddOrUpdatePlayerEntry(id2, killedPeer.Name, InteractionType.Killed, killedPeer.GetNetworkPeer().ForcedAvatarIndex); } else { if (!(id2 == this._myId) || !(id1 != this._myId)) { return; } RecentPlayersManager.AddOrUpdatePlayerEntry(id1, killerPeer.Name, InteractionType.KilledBy, killerPeer.GetNetworkPeer().ForcedAvatarIndex); } }
private void OnPostRoundEnd() { if (!this.UseGold() || this.RoundController.IsMatchEnding) { return; } foreach (NetworkCommunicator networkPeer in GameNetwork.NetworkPeers) { MissionPeer component = networkPeer.GetComponent <MissionPeer>(); if (component != null && this.RoundController.RoundCount > 0) { int num1 = 300; int num2 = this.GetCurrentGoldForPeer(component); if (num2 < 0) { num2 = 80; } else if (component.Team != null && component.Team.Side != BattleSideEnum.None && (this.RoundController.RoundWinner == component.Team.Side && component.GetComponent <FlagDominationMissionRepresentative>().CheckIfSurvivedLastRoundAndReset())) { num2 += 30; } int newAmount = num1 + MBMath.ClampInt(num2, 0, 80); if (newAmount > 300) { this.NotificationsComponent.GoldCarriedFromPreviousRound(newAmount - 300, component.GetNetworkPeer()); } this.ChangeCurrentGoldForPeer(component, newAmount); } } }
protected virtual void OnBotDies(Agent botAgent, MissionPeer assistorPeer) { if (assistorPeer != null) { GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(assistorPeer.GetNetworkPeer(), (NetworkCommunicator)null, assistorPeer.KillCount, assistorPeer.AssistCount, assistorPeer.DeathCount, assistorPeer.Score)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } if (botAgent == null) { return; } if (botAgent.Formation?.PlayerOwner != null) { NetworkCommunicator networkCommunicator = GameNetwork.NetworkPeers.SingleOrDefault <NetworkCommunicator>((Func <NetworkCommunicator, bool>)(x => x.GetComponent <MissionPeer>() != null && x.GetComponent <MissionPeer>().ControlledFormation == botAgent.Formation)); if (networkCommunicator != null) { MissionPeer component = networkCommunicator.GetComponent <MissionPeer>(); ++component.DeathCount; --component.BotsUnderControlAlive; this._missionScoreboardComponent.PlayerPropertiesChanged(networkCommunicator); GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(networkCommunicator, (NetworkCommunicator)null, component.KillCount, component.AssistCount, component.DeathCount, component.Score)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new BotsControlledChange(networkCommunicator, component.BotsUnderControlAlive, component.BotsUnderControlTotal)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } } else { MissionScoreboardComponent.MissionScoreboardSide sideSafe = this._missionScoreboardComponent.GetSideSafe(botAgent.Team.Side); BotData botScores = sideSafe.BotScores; ++botScores.DeathCount; --botScores.AliveCount; GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.BotData(sideSafe.Side, botScores.KillCount, botScores.AssistCount, botScores.DeathCount, botScores.AliveCount)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } this._missionScoreboardComponent.BotPropertiesChanged(botAgent.Team.Side); }
public void RemoveAgentVisuals(MissionPeer missionPeer, bool sync = false) { missionPeer.ClearAllVisuals(); if (!GameNetwork.IsDedicatedServer && !missionPeer.Peer.IsMine) { this._spawnFrameSelectionHelper.FreeSpawnPointFromPlayer(missionPeer.Peer); } if (sync && GameNetwork.IsServerOrRecorder) { GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new RemoveAgentVisualsForPeer(missionPeer.GetNetworkPeer())); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } missionPeer.HasSpawnedAgentVisuals = false; if (this.OnMyAgentVisualRemoved != null && missionPeer.IsMine) { this.OnMyAgentVisualRemoved(); } Debug.Print("Removed visuals.", color: Debug.DebugColor.BrightWhite, debugFilter: 64UL); }
public void KickPlayer(NetworkCommunicator peerToKick, bool banPlayer) { if (GameNetwork.IsServer || GameNetwork.IsDedicatedServer) { if (peerToKick.IsMine) { return; } MissionPeer component = peerToKick.GetComponent <MissionPeer>(); if (component == null) { return; } if (banPlayer) { if (GameNetwork.IsClient) { BannedPlayerManagerCustomGameClient.AddBannedPlayer(component.Peer.Id, GameNetwork.IsDedicatedServer ? -1 : Environment.TickCount + 600000); } else if (GameNetwork.IsDedicatedServer) { BannedPlayerManagerCustomGameServer.AddBannedPlayer(component.Peer.Id, component.GetNetworkPeer().UserName, GameNetwork.IsDedicatedServer ? -1 : Environment.TickCount + 600000); } } if (GameNetwork.IsDedicatedServer) { throw new NotImplementedException(); } NetworkMain.GameClient.KickPlayer(component.Peer.Id, banPlayer); } else { if (!GameNetwork.IsClient) { return; } GameNetwork.BeginModuleEventAsClient(); GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromClient.KickPlayer(peerToKick, banPlayer)); GameNetwork.EndModuleEventAsClient(); } }
private void SendPeerInformationsToPeer(NetworkCommunicator peer) { foreach (NetworkCommunicator networkPeer in GameNetwork.NetworkPeers) { if (networkPeer.IsSynchronized) { MissionPeer component = networkPeer.GetComponent <MissionPeer>(); GameNetwork.BeginModuleEventAsServer(peer); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(component.GetNetworkPeer(), (NetworkCommunicator)null, component.KillCount, component.AssistCount, component.DeathCount, component.Score)); GameNetwork.EndModuleEventAsServer(); if (component.BotsUnderControlAlive != 0 || component.BotsUnderControlTotal != 0) { GameNetwork.BeginModuleEventAsServer(peer); GameNetwork.WriteMessage((GameNetworkMessage) new BotsControlledChange(component.GetNetworkPeer(), component.BotsUnderControlAlive, component.BotsUnderControlTotal)); GameNetwork.EndModuleEventAsServer(); } } } }