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

public class HitMarker : MonoBehaviour {

    public Image image;
    bool active = false;
    float disappearTime = 0f;
    float activeTime = 0.25f;

    public IEnumerator Activate() {
        if (active) {
            // add to disappear time
            disappearTime = Time.unscaledTime + activeTime;
            yield break;
        }

        disappearTime = Time.unscaledTime + activeTime;

        image.enabled = true;

        while (Time.unscaledTime < disappearTime) {
            yield return null;
        }

        image.enabled = false;
    }

}
