using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class MobBase : LevelObjectBase
{

    public int Damage;
    public float Speed;
    public float AttackCooldownInSeconds;
    public RandomSoundPlayer randomSoundPlayer;
    private bool playingRandomSound;

    protected override void HPZero()
    {
        float xPosition = transform.position.x;
        LevelObjectFaction faction = ObjectFaction;

        EventManager.TriggerMobDeath(xPosition, faction);
        Destroyed = true;
        Kill();
    }

    public void DonePlayingRandomSound()
    {
        playingRandomSound = false;
    }

    public bool IsPlayingRandomSound()
    {
        return playingRandomSound;
    }

    public void PlayRandomSound()
    {
        if (randomSoundPlayer != null)
        {
            playingRandomSound = true;
            randomSoundPlayer.PlaySound();
        }
    }

    public override void Init()
    {
        base.Init();
        playingRandomSound = false;
    }

}
