Project_WL/Assets/Script/Character/PC/PCUIActor.cs

31 lines
584 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PCUIActor : MonoBehaviour
{
public void Set()
{
Play_UIAttack();
}
private void OnEnable()
{
Play_UIAttack();
}
void Play_UIAttack()
{
if (gameObject.activeInHierarchy)
StartCoroutine(Co_UIAttack());
}
IEnumerator Co_UIAttack()
{
var anim = GetComponent<Animation>();
anim.Play("uiattack");
yield return new WaitForSeconds(anim["uiattack"].length);
anim.Play("idle");
}
}