You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1015 B
42 lines
1015 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
/// <summary>
|
|
/// 交互特效
|
|
/// </summary>
|
|
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<Image>().fillAmount = 0;
|
|
float onceValue = 1 / time * Time.deltaTime;
|
|
while (GetComponent<Image>().fillAmount<1)
|
|
{
|
|
yield return new WaitForEndOfFrame();
|
|
GetComponent<Image>().fillAmount += onceValue;
|
|
}
|
|
GameManager.Instance.InteractEnd();
|
|
EffectManager.Instance.DisableInteractEffect();
|
|
}
|
|
|
|
|
|
public void EndInteract()
|
|
{
|
|
if(_coroutine == null) return;
|
|
StopCoroutine(_coroutine);
|
|
_coroutine = null;
|
|
GetComponent<Image>().fillAmount = 0;
|
|
}
|
|
}
|