public void OnLocalDeath(bl_KillCam kc) { if (GetGameMode != GameMode.DM) { return; } bl_DemolitionBombManager.Instance.OnLocalDeath(); LocalKillCamera = kc; Player friend = null; //after local die, and round have not finish, find a team player to spectating if (PhotonNetwork.LocalPlayer.GetPlayerTeam() == Team.Team1) { if (Team1AlivePlayers.Values.Count > 0) { friend = Team1AlivePlayers.Values.ElementAt(UnityEngine.Random.Range(0, Team1AlivePlayers.Values.Count)); } } else { if (Team2AlivePlayers.Values.Count > 0) { friend = Team2AlivePlayers.Values.ElementAt(UnityEngine.Random.Range(0, Team2AlivePlayers.Values.Count)); } } if (friend != null) { GameObject player = FindPhotonPlayer(friend); LocalKillCamera.SpectPlayer(player.transform); } }
void Death(string Killer) { GameObject DeatBody = Instantiate(m_ragdoll, Camera.main.transform.position, Camera.main.transform.rotation) as GameObject; bl_KillCam killcam = DeatBody.GetComponent <bl_KillCam>(); killcam.Send_Target(Killer, Respawn_Time); Destroy(this.gameObject); }
public override void OnInspectorGUI() { bl_KillCam script = (bl_KillCam)target; bool allowSceneObjects = !EditorUtility.IsPersistent(script); EditorGUILayout.BeginVertical("window"); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("", "UI Style", "Button"); script.UI.Skin = EditorGUILayout.ObjectField("GUI Skin", script.UI.Skin, typeof(UnityEngine.GUISkin), allowSceneObjects) as UnityEngine.GUISkin; script.UI.KillCamEffect = EditorGUILayout.ObjectField("Kill Cam Effect ", script.UI.KillCamEffect, typeof(UnityEngine.Texture2D), allowSceneObjects) as UnityEngine.Texture2D; script.UI.InfoBackGround = EditorGUILayout.ObjectField("Info Effect ", script.UI.InfoBackGround, typeof(UnityEngine.Texture2D), allowSceneObjects) as UnityEngine.Texture2D; script.UI.UIColor = EditorGUILayout.ColorField("UI Color ", script.UI.UIColor); script.KillCamTitle = EditorGUILayout.TextField("Kill Cam Title", script.KillCamTitle); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("", "Targets", "Button"); script.TagTargets = EditorGUILayout.TagField("Enemy", script.TagTargets); script.Provide = EditorGUILayout.ObjectField("Provide", script.Provide, typeof(UnityEngine.Transform), allowSceneObjects) as UnityEngine.Transform; script.m_wait = EditorGUILayout.IntField("Wait for Controll", script.m_wait); EditorGUILayout.Space(); script.distanceMax = EditorGUILayout.FloatField("Max Distance", script.distanceMax); script.distanceMin = EditorGUILayout.FloatField("Min Distance", script.distanceMin); EditorGUILayout.Space(); script.xSpeed = EditorGUILayout.FloatField("X Speed", script.xSpeed); script.ySpeed = EditorGUILayout.FloatField("Y Speed", script.ySpeed); EditorGUILayout.Space(); script.yMaxLimit = EditorGUILayout.FloatField("Max Y Limit", script.yMaxLimit); script.yMinLimit = EditorGUILayout.FloatField("Min Y Litmit", script.yMinLimit); if (script.SmoothMovement) { script.SpeedSmooth = EditorGUILayout.FloatField("Smooth Speed", script.SpeedSmooth); } EditorGUILayout.Space(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("", "Bools", "Button"); script.SmoothMovement = EditorGUILayout.Toggle("Smooth Movement", script.SmoothMovement); script.Can_See_Other = EditorGUILayout.Toggle("Can see others", script.Can_See_Other); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); }
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"); } }