using System;
using System.Collections;
using System.Collections.Generic;
using MPStudio;
using UnityEngine;
//Author: SkyAllen Email: 894982165@qq.com Website: www.ytn0.com
namespace MPStudio
{
    [RequireComponent(typeof(ShowHideSound2))]
    public class WarnGroup : MonoBehaviour
    {
        public int Count_per_0dot5 = 10;

        private CanvasGroup canvasGroup;

        private void Awake()
        {
            canvasGroup = GetComponent<CanvasGroup>();
            if (canvasGroup == null)
            {
                canvasGroup = gameObject.AddComponent<CanvasGroup>();
            }
        }


        private void OnEnable()
        {
            StartCoroutine(Animal());
        }


        IEnumerator Animal()
        {
            for (int i = 0; i < Count_per_0dot5; i++)
            {
                canvasGroup.alpha = 0;
                yield return new WaitForSeconds(0.25f);
                canvasGroup.alpha = 1;
                yield return new WaitForSeconds(0.25f);
            }

            gameObject.SetActive(false);
        }


    }
}