小问题修复
This commit is contained in:
parent
ee323f82e9
commit
333fae2309
|
@ -130163,7 +130163,7 @@ AnimationClip:
|
|||
data:
|
||||
objectReferenceParameter: {fileID: 0}
|
||||
floatParameter: 0
|
||||
intParameter: 2
|
||||
intParameter: 3
|
||||
messageOptions: 0
|
||||
- time: 49.9
|
||||
functionName: StartSampling
|
||||
|
|
|
@ -8,7 +8,6 @@ public class GudieAnimationManager : MonoBehaviour
|
|||
{
|
||||
private Animator _animator;
|
||||
private string _currName;
|
||||
private bool _isAnimationStartPlay;
|
||||
private List<AvatarAction> _actionList = new List<AvatarAction>();
|
||||
|
||||
private List<string> _actionNameList = new List<string>();
|
||||
|
@ -23,7 +22,7 @@ public class GudieAnimationManager : MonoBehaviour
|
|||
AnimationClip[] clips = Animator.runtimeAnimatorController.animationClips;
|
||||
foreach (AnimationClip clip in clips)
|
||||
{
|
||||
if (_actionNameList.Contains(clip.name))
|
||||
if (ActionNameList.Contains(clip.name))
|
||||
{
|
||||
_animationLength += clip.length;
|
||||
}
|
||||
|
@ -51,9 +50,9 @@ public class GudieAnimationManager : MonoBehaviour
|
|||
{
|
||||
if (_actionNameList.Count == 0)
|
||||
{
|
||||
foreach (var item in Enum.GetNames(typeof(AvatarAction)))
|
||||
foreach (var item in _actionList)
|
||||
{
|
||||
_actionNameList.Add(item);
|
||||
_actionNameList.Add(item.ToString());
|
||||
}
|
||||
}
|
||||
return _actionNameList;
|
||||
|
@ -64,7 +63,6 @@ public class GudieAnimationManager : MonoBehaviour
|
|||
private void Awake()
|
||||
{
|
||||
_animator = transform.GetComponentInChildren<Animator>();
|
||||
_isAnimationStartPlay = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +75,6 @@ public class GudieAnimationManager : MonoBehaviour
|
|||
|
||||
public void PlayCurrentActionList(List<AvatarAction> actionList)
|
||||
{
|
||||
_isAnimationStartPlay = true;
|
||||
_actionList = actionList;
|
||||
|
||||
AnimationClip[] clips = Animator.runtimeAnimatorController.animationClips;
|
||||
|
@ -96,21 +93,11 @@ public class GudieAnimationManager : MonoBehaviour
|
|||
|
||||
private void Update()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_currName))
|
||||
if (string.IsNullOrEmpty(_currName) || _actionList.Count == 0)
|
||||
return;
|
||||
|
||||
if (!_isAnimationStartPlay)
|
||||
return;
|
||||
|
||||
var currName = GetCurrentAnimationName();
|
||||
if (!ActionNameList.Contains(currName))
|
||||
{
|
||||
Play(ActionNameList[YogaManager.Instance.ActionIndex]);
|
||||
return;
|
||||
}
|
||||
|
||||
//当未达到指标且动画播放完毕时,重新播放
|
||||
if (Animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1.0f && GetCurrentAnimationName().Equals(Enum.GetName(typeof(AvatarAction), _actionList[YogaManager.Instance.ActionIndex])))
|
||||
if (Animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1.0f)
|
||||
{
|
||||
//如果列表动画index小于列表长度,播放下一个动画
|
||||
YogaManager.Instance.ActionIndex++;
|
||||
|
|
Loading…
Reference in New Issue