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

public class SmokeDestroy : MonoBehaviour
{
    public float stayTime;
    [HideInInspector]
    public float time;
    public float hitRate;
    private void Update()
    {
        time += Time.deltaTime;
        if(time >= stayTime)
        {
            gameObject.SetActive(false);
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        AttackTrigger attackTrigger = other.GetComponent<AttackTrigger>();
        if (attackTrigger != null)
        {
            attackTrigger.hitRate = hitRate;
        }
    }
    private void OnTriggerExit(Collider other)
    {
        AttackTrigger attackTrigger = other.GetComponent<AttackTrigger>();
        if (attackTrigger != null)
        {
            attackTrigger.hitRate = 1;
        }
    }
}
