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

public class GiveImpact05 : MonoBehaviour
{
    private Controller controller;
    public float timeImpact;
    public GameObject parent;
    // Start is called before the first frame update
    void Awake() 
    {
        controller = GameObject.Find("Controller").GetComponent<Controller>();   
         
    }

    void Update()
    {
        if (timeImpact > 0)
        {
            timeImpact -= Time.deltaTime;
        }
        else
        {
            if (parent.GetComponent<VirusMoving>())
            {controller.medImpact = 0;}
            if (parent.GetComponent<PillMoving>())
            {controller.virusImpact = 0;}
            
            Destroy(parent);
        }
    }
}
