获取PHP游戏源码spine动画时间
获取PHP游戏源码spine动画时间的相关代码
public static float GetCurrentAniTime(Transform skeletonAnimation,string name) { if (skeletonAnimation == null) { Debug.LogError("(skeletonAnimation Transform == null"); } SkeletonAnimation skeleton = skeletonAnimation.GetComponent<SkeletonAnimation>(); float duration = 0; if (skeleton == null) { SkeletonGraphic skeletonGraphic = skeletonAnimation.GetComponent<SkeletonGraphic>(); if (skeletonGraphic == null) { Debug.LogError("(skeletonAnimation == null"); } else { var skeletonData = skeletonGraphic. skeletonDataAsset.GetAnimationStateData().SkeletonData; if (skeletonData.FindAnimation(name)!=null) { duration = (float)Math.Round(skeletonData.FindAnimation(name).Duration); } else { Debug.LogError($"dont Find Animation {name}"); } } } else { duration = (float)Math.Round(skeleton. skeletonDataAsset.GetAnimationStateData().SkeletonData.FindAnimation(name).Duration); } return duration; }
以上就是 获取PHP游戏源码spine动画时间的相关代码,更多内容欢迎关注之后的文章