using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
///
/// 交互特效
///
public class InteractEffect : Effect
{
private float time = 1.5f;
private Coroutine _coroutine;
public void StartInteract(Vector3 pos)
{
ChangeEffectPos(pos);
_coroutine = StartCoroutine(E_Start());
}
IEnumerator E_Start()
{
GetComponent().fillAmount = 0;
float onceValue = 1 / time * Time.deltaTime;
while (GetComponent().fillAmount<1)
{
yield return new WaitForEndOfFrame();
GetComponent().fillAmount += onceValue;
}
GameManager.Instance.InteractEnd();
EffectManager.Instance.DisableInteractEffect();
}
public void EndInteract()
{
if(_coroutine == null) return;
StopCoroutine(_coroutine);
_coroutine = null;
GetComponent().fillAmount = 0;
}
}