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

public class TargetAlly : TargetWithLifeThatNotifies
{
    BaseAlly Ally;
    float LoseLifeCheck = 2.0f;

    private void Awake()
    {
        Ally = GetComponent<BaseAlly>();
    }

    private void Update()
    {
        if (LoseLifeCheck <= 0)
        {
            if (Ally)
            {
                Ally.IsBeingAttacked = false;
            }
        }

        LoseLifeCheck -= Time.deltaTime;
    }

    protected override void LoseLife(DamageType damageType, float howMuch)
    {
        if (Ally)
        {
            LoseLifeCheck = 2.0f;
            Ally.IsBeingAttacked = true;
        }

        base.LoseLife(damageType, howMuch);
    }
}
