NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Weapon/WeaponAnim.cs

32 lines
801 B
C#

using UnityEngine;
namespace Code.Scripts.Gameplay.Weapon
{
public class WeaponAnim
{
public GameObject rootObj;
public Animator rawAnim;
public WeaponAnim(GameObject rootObj)
{
this.rootObj = rootObj;
DebugUtil.Log($"获取到武器root节点:{this.rootObj.name}");
// rawAnim = rootObj.GetComponent<Animator>();
}
public void PlayAnim(string animName)
{
if (string.IsNullOrEmpty(animName))
{
return;
}
if (rawAnim == null)
{
DebugUtil.LogError($"配表需求播放:{animName}但是没有动画组件");
return;
}
rawAnim.Play(animName, 0, 0);
}
}
}