Esempio n. 1
0
        public void EndAction(string _actionHelperName)
        {
            ActionHelperStorage storage = null;

            if ((this.actionHelperMap.TryGetValue(_actionHelperName, out storage) && storage.waitForEvents) && (base.gameObject.GetComponent <Animator>() != null))
            {
                storage.StopLastAction();
            }
        }
        public void EndAction(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;
            }
            actionHelperStorage.StopLastAction();
        }
 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();
                 }
             }
         }
     }
 }