52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using DG.Tweening;
|
|
using Stary.Evo;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Main
|
|
{
|
|
public class KKFsmSystem : FsmSystem, IFsmSystem
|
|
{
|
|
public GameObject kk;
|
|
|
|
public Animator animator;
|
|
public Image image;
|
|
public Text text;
|
|
public KKFsmSystem(GameObject kk)
|
|
{
|
|
this.kk = kk;
|
|
this.animator = kk.GetComponentInChildren<Animator>();
|
|
this.image = kk.GetComponentInChildren<Image>();
|
|
this.image.color = new Color(1, 1, 1, 0);
|
|
this.text = kk.GetComponentInChildren<Text>();
|
|
this.text.color = new Color(1, 1, 1, 0);
|
|
}
|
|
|
|
public void OpenImage()
|
|
{
|
|
this.image.DOFade(1, 1f);
|
|
}
|
|
|
|
public void CloseImage()
|
|
{
|
|
this.image.DOFade(0, 1f);
|
|
}
|
|
|
|
public void OpenText()
|
|
{
|
|
this.text.DOFade(1, 1f);
|
|
}
|
|
|
|
public void CloseText()
|
|
{
|
|
this.text.DOFade(0, 1f);
|
|
}
|
|
|
|
public float GetAnimationProgress(int layerIndex = 0)
|
|
{
|
|
if (animator == null) return 0;
|
|
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(layerIndex);
|
|
return stateInfo.normalizedTime % 1;
|
|
}
|
|
}
|
|
} |