void SyncDamage(float t_damage, string t_from, string t_weapon, Vector3 m_direction, bool isHeatShot, int weaponID, PhotonPlayer m_sender) { if (dead) { return; } if (DamageEnabled) { if (health > 0) { if (isMine) { m_alpha += (t_damage * m_UIIntensity); bl_EventHandler.OnLocalPlayerShake(ShakeAmount, ShakeTime); if (Indicator != null) { Indicator.AttackFrom(m_direction); } TimeToRegenerate = StartRegenerateIn; } else { if (m_sender != null) { if (m_sender.NickName == base.LocalName) { bl_UCrosshair.Instance.OnHit(); } } } } if (HitsSound.Length > 0 && t_weapon != FallMethod)//Audio effect of hit { AudioSource.PlayClipAtPoint(HitsSound[Random.Range(0, HitsSound.Length)], this.transform.position, 1.0f); } } if (health > 0) { m_LastShot = t_from; health -= t_damage; } if (health <= 0) { health = 0.0f; Die(m_LastShot, isHeatShot, t_weapon, weaponID, m_direction); if (isMine) { bl_GameManager.isAlive = false; bl_EventHandler.PlayerLocalDeathEvent(); } } }
void SyncDamage(float damage, string killer, DamageCause cause, Vector3 m_direction, bool isHeatShot, int weaponID, Player m_sender) { if (dead || isProtectionEnable) { return; } if (DamageEnabled) { if (health > 0) { if (isMine) { damageAlphaValue += (damage + ((maxHealth - health) * (Time.deltaTime * Mathf.PI))) * 0.2f; bl_EventHandler.PlayerLocalShakeEvent(ShakeAmount, ShakeTime); if (Indicator != null) { Indicator.AttackFrom(m_direction); } TimeToRegenerate = StartRegenerateIn; } else { if (m_sender != null) { if (m_sender.NickName == LocalName) { bl_UCrosshair.Instance.OnHit(); } } } } if (cause != DamageCause.FallDamage && cause != DamageCause.Fire) { if (HitsSound.Length > 0)//Audio effect of hit { AudioSource.PlayClipAtPoint(HitsSound[Random.Range(0, HitsSound.Length)], transform.position, 1.0f); } } else { AudioSource.PlayClipAtPoint(InjuredSounds[Random.Range(0, InjuredSounds.Length)], transform.position, 1.0f); } } if (health > 0) { m_LastShot = killer; health -= damage; if (!isMine) { PlayerSync.m_PlayerAnimation.OnGetHit(); } else { UpdateUI(); } } if (health <= 0) { health = 0.0f; Die(m_LastShot, isHeatShot, cause, weaponID, m_direction, m_sender); if (isMine) { bl_GameManager.isAlive = false; bl_EventHandler.PlayerLocalDeathEvent(); } } }