miepzerino
2023-12-29 fc9527729835277b295ba2c59b60c86d630e9dbe
Assets/Scripts/Damageable.cs
@@ -1,3 +1,4 @@
using Assets.Scripts.Enums;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -23,9 +24,9 @@
    private float timeSinceHit = 0f;
    public float invincibilityTime = 0.25f;
    public AudioClip hitSound;
    public AudioClip healSound;
    public AudioClip deathSound;
    public SoundName hitSound;
    public SoundName healSound;
    public SoundName deathSound;
    public int MaxHealth
    {
@@ -48,10 +49,11 @@
            if (value <= 0)
            {
                IsAlive = false;
                if (deathSound != null)
                {
                    SoundManager.instance.PlaySoundAtPoint(gameObject, deathSound.name);
                }
                // Not needed here as it's played from the Animator
                //if (deathSound != null)
                //{
                SoundManager.instance.PlaySoundAtPoint(gameObject, deathSound);
                //}
            }
        }
    }
@@ -101,10 +103,7 @@
            isInvincible = true;
            CharacterEvents.characterDamaged.Invoke(gameObject, actualDamageAmount);
            if (hitSound != null)
            {
                SoundManager.instance.PlaySoundAtPoint(gameObject, hitSound.name);
            }
            SoundManager.instance.PlaySoundAtPoint(gameObject, hitSound);
        }
    }
@@ -119,10 +118,7 @@
            CharacterEvents.characterHealed.Invoke(gameObject, actualHealAmount);
            result = true;
            if (healSound != null)
            {
                SoundManager.instance.PlaySoundAtPoint(gameObject, healSound.name);
            }
            SoundManager.instance.PlaySoundAtPoint(gameObject, healSound);
        }
        return result;