/// <summary> /// Called This when player Die Logic /// </summary> /// <param name="t_from"></param> void Die(string t_from, bool isHeat, string t_weapon, int w_id) { dead = true; if (!localPlayer) { mBodyManager.Ragdolled();// convert into ragdoll the remote player } for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(false); } //Spawn ragdoll if (!localPlayer)// when player is not ours { if (m_LastShot == base.LocalName) { AddKill(isHeat, t_weapon, w_id); } } else//when is our { AddDeath(); GameObject ragdoll; ragdoll = Instantiate(m_Ragdoll, transform.position, transform.rotation) as GameObject; ragdoll.GetComponent <bl_Ragdoll>().GetVelocity(this.GetComponent <CharacterController>().velocity); ragdoll.GetComponent <bl_Ragdoll>().RespawnAfter(5.0f, m_LastShot); if (t_from == base.LocalName) { bl_EventHandler.KillEvent(base.LocalName, "", "Has committed suicide", myTeam, 5, 20); } StartCoroutine(DestroyThis()); } }
/// <summary> /// Called This when player Die Logic /// </summary> void Die(string t_from, bool isHeat, string t_weapon, int w_id, Vector3 hitPos) { dead = true; m_CharacterController.enabled = false; if (!isMine) { mBodyManager.Ragdolled(hitPos);// convert into ragdoll the remote player } for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(false); } //Spawn ragdoll if (!isMine)// when player is not ours { if (m_LastShot == base.LocalName) { AddKill(isHeat, t_weapon, w_id); } } else//when is our { AddDeath(); Vector3 pos = new Vector3(transform.position.x, transform.position.y - 0.96f, transform.position.z); GameObject ragdoll = Instantiate(m_Ragdoll, pos, transform.rotation) as GameObject; Transform ngr = (bl_GameData.Instance.DropGunOnDeath) ? null : PlayerSync.NetGunsRoot; ragdoll.GetComponent <bl_Ragdoll>().RespawnAfter(GameData.PlayerRespawnTime, m_LastShot, ngr); if (t_from == base.LocalName) { bl_EventHandler.KillEvent(base.LocalName, "", bl_GameTexts.CommittedSuicide, myTeam, 5, 20); } if (bl_GameData.Instance.DropGunOnDeath) { GunManager.ThrwoCurrent(); } StartCoroutine(DestroyThis()); } }
/// <summary> /// Called This when player Die Logic /// </summary> void Die(string killer, bool isHeat, DamageCause cause, int gunID, Vector3 hitPos, Player sender) { dead = true; m_CharacterController.enabled = false; if (!isMine) { BodyManager.Ragdolled(hitPos);// convert into ragdoll the remote player } else { Transform ngr = (bl_GameData.Instance.DropGunOnDeath) ? null : PlayerSync.NetGunsRoot; BodyManager.SetLocalRagdoll(hitPos, ngr, m_CharacterController.velocity); } for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(false); } string weapon = cause.ToString(); if (cause == DamageCause.Player || cause == DamageCause.Bot || cause == DamageCause.Explosion) { weapon = bl_GameData.Instance.GetWeapon(gunID).Name; } //Spawn ragdoll if (!isMine)// when player is not ours { if (m_LastShot == LocalName) { AddKill(isHeat, weapon, gunID); } if (!isOneTeamMode) { if (photonView.Owner.GetPlayerTeam() == PhotonNetwork.LocalPlayer.GetPlayerTeam()) { GameObject di = bl_ObjectPooling.Instance.Instantiate("deathicon", transform.position, transform.rotation); di.GetComponent <bl_ClampIcon>().SetTempIcon(DeathIcon, DeathIconShowTime, 20); } } } else//when is our { AddDeath(); //show kill cam BodyManager.gameObject.name = "YOU"; GameObject kc = Instantiate(KillCamPrefab, transform.position, transform.rotation) as GameObject; kc.GetComponent <bl_KillCam>().SetTarget(sender, cause, killer, BodyManager.PelvisBone); bl_UIReferences.Instance.OnKillCam(true, killer, gunID); BodyManager.KillCameraCache = kc; #if ELIM bl_Elimination.Instance.OnLocalDeath(kc.GetComponent <bl_KillCam>()); #endif if (killer == LocalName) { #if LOCALIZATION if (cause == DamageCause.FallDamage) { bl_EventHandler.KillEvent(LocalName, string.Empty, bl_Localization.Instance.GetText(20), myTeam, 5, 20); } else { bl_EventHandler.KillEvent(LocalName, string.Empty, bl_Localization.Instance.GetText(19), myTeam, 5, 20); } #else if (cause == DamageCause.FallDamage) { bl_EventHandler.KillEvent(LocalName, string.Empty, bl_GameTexts.DeathByFall, myTeam, 5, 20); } else { bl_EventHandler.KillEvent(LocalName, string.Empty, bl_GameTexts.CommittedSuicide, myTeam, 5, 20); } #endif } if (bl_GameData.Instance.DropGunOnDeath) { GunManager.ThrwoCurrent(true); } if (cause == DamageCause.Bot) { bl_EventHandler.KillEvent(killer, gameObject.name, weapon, myTeam, 5, 20); bl_AIMananger.Instance.SetBotKill(killer); } StartCoroutine(DestroyThis()); } }