public void OnLocalDeath(bl_KillCam kc) { if (GetGameMode != GameMode.ELIM) { return; } LocalKillCamera = kc; MFPSPlayer friend = null; //after local die, and round have not finish, find a team player to spectating if (PhotonNetwork.LocalPlayer.GetPlayerTeam() == Team.Team1) { if (Team1AlivePlayers.Count > 0) { friend = Team1AlivePlayers.Values.ElementAt(Random.Range(0, Team1AlivePlayers.Values.Count)); } } else { if (Team2AlivePlayers.Count > 0) { friend = Team2AlivePlayers.Values.ElementAt(Random.Range(0, Team2AlivePlayers.Values.Count)); } } if (friend != null && friend.Actor != null) { GameObject player = friend.Actor.gameObject; if (player != null) { LocalKillCamera.SpectPlayer(player.transform); } } else { Debug.Log("Any friend available to spectate"); } }
/// <summary> /// /// </summary> void SelectPlayerToCarrieBomb(out int viewID, out int actorNumber) { MFPSPlayer[] players = bl_GameManager.Instance.OthersActorsInScene.Where(x => x.Team == terroristsTeam).ToArray(); if (players.Length <= 0) { if (PhotonNetwork.LocalPlayer.GetPlayerTeam() == terroristsTeam) { actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; viewID = bl_GameManager.LocalPlayerViewID; } else { Debug.Log("There's not players in Terrorist team"); actorNumber = 0; viewID = 0; } } else { MFPSPlayer p = players[Random.Range(0, players.Length)]; actorNumber = p.ActorView.Owner.ActorNumber; viewID = p.ActorView.ViewID; } }