Пример #1
0
    public void InflictDamage(float damage, bool isExplosionDamage, GameObject damageSource)
    {
        if (health)
        {
            var totalDamage = damage;

            // skip the crit multiplier if it's from an explosion
            if (!isExplosionDamage)
            {
                totalDamage *= damageMultiplier;
            }

            // potentially reduce damages if inflicted by self
            if (health.gameObject == damageSource)
            {
                totalDamage *= sensibilityToSelfdamage;
            }

            // if the player has glasses, remove the glasses
            if (player != null && m_PlayerController.playerHasGlasses())
            {
                m_PlayerController.setPlayerGlassesStatus(false);
                damageSound.Play();
            }
            else
            {
                // apply the damages
                health.TakeDamage(totalDamage, damageSource);
            }
        }
    }
Пример #2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject == player && !playerController.playerHasGlasses())
        {
            playerController.setPlayerGlassesStatus(true);
            volume.profile.TryGetSettings(out dof);
            pickUpSFX.Play();

            dof.enabled.value = false;

            Destroy(gameObject);
        }
    }