예제 #1
0
        private void PlayerHeal(Collision collision)
        {
            var currentHealth = player.GetCurrentHealth(trackHealth);
            var maxHealth     = player.GetMaxHealth(trackHealth);

            if (collision.gameObject.GetComponent <HealingOnCollision>() != null)
            {
                var healingType      = collision.gameObject.GetComponent <HealingOnCollision>().healingEffect;
                var collisionHealing = player.GetHealingValues(healingType);

                if (currentHealth > Mathf.Epsilon || currentHealth < maxHealth)
                {
                    player.GetHealing(collisionHealing);

                    Physics.IgnoreCollision(collision.gameObject.GetComponent <Collider>(), astronaut.GetComponent <Collider>(), false);
                    state = State.Alive;
                    audioSource.PlayOneShot(healingPortion);
                    healParticles.Play();
                    Destroy(collision.gameObject);
                }
            }
        }