public void BeginAction(string _actionHelperName) { ActionHelperStorage actionHelperStorage = null; if (!this.actionHelperMap.TryGetValue(_actionHelperName, out actionHelperStorage)) { return; } if (!actionHelperStorage.waitForEvents) { return; } Animator component = base.gameObject.GetComponent <Animator>(); if (component == null) { return; } if (actionHelperStorage.detectStatePath.get_Length() > 0) { bool flag = false; for (int i = 0; i < component.layerCount; i++) { if (component.GetCurrentAnimatorStateInfo(i).nameHash == actionHelperStorage.GetDetectStatePathHash()) { flag = true; break; } AnimatorStateInfo nextAnimatorStateInfo = component.GetNextAnimatorStateInfo(i); if (component.IsInTransition(i) && nextAnimatorStateInfo.nameHash == actionHelperStorage.GetDetectStatePathHash()) { flag = true; break; } } if (flag) { actionHelperStorage.PlayAction(); } } else { actionHelperStorage.PlayAction(); } }
public void BeginAction(string _actionHelperName) { ActionHelperStorage storage = null; if (this.actionHelperMap.TryGetValue(_actionHelperName, out storage) && storage.waitForEvents) { Animator component = base.gameObject.GetComponent <Animator>(); if (component != null) { if (storage.detectStatePath.Length <= 0) { storage.PlayAction(); } else { bool flag2 = false; for (int i = 0; i < component.layerCount; i++) { if (component.GetCurrentAnimatorStateInfo(i).nameHash == storage.GetDetectStatePathHash()) { flag2 = true; break; } AnimatorStateInfo nextAnimatorStateInfo = component.GetNextAnimatorStateInfo(i); if (component.IsInTransition(i) && (nextAnimatorStateInfo.nameHash == storage.GetDetectStatePathHash())) { flag2 = true; break; } } if (flag2) { storage.PlayAction(); } } } } }
private void Update() { if (this.animator) { ActionHelperStorage[] array = this.actionHelpers; for (int i = 0; i < array.Length; i++) { ActionHelperStorage actionHelperStorage = array[i]; if (actionHelperStorage.detectStatePath.get_Length() > 0) { bool flag = false; for (int j = 0; j < this.animator.layerCount; j++) { if (this.animator.GetCurrentAnimatorStateInfo(j).nameHash == actionHelperStorage.GetDetectStatePathHash()) { flag = true; break; } AnimatorStateInfo nextAnimatorStateInfo = this.animator.GetNextAnimatorStateInfo(j); if (this.animator.IsInTransition(j) && nextAnimatorStateInfo.nameHash == actionHelperStorage.GetDetectStatePathHash()) { flag = true; break; } } if (flag) { if (!actionHelperStorage.waitForEvents && !actionHelperStorage.IsLastActionActive()) { actionHelperStorage.PlayAction(); } } else { actionHelperStorage.StopLastAction(); } } } } }