コード例 #1
0
        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();
            }
        }
コード例 #2
0
        public Action PlayAction(string _actionHelperName, DictionaryView <string, GameObject> dictionary)
        {
            ActionHelperStorage actionHelperStorage = null;

            if (!this.actionHelperMap.TryGetValue(_actionHelperName, out actionHelperStorage))
            {
                return(null);
            }
            actionHelperStorage.autoPlay = true;
            return(actionHelperStorage.PlayAction(dictionary));
        }
コード例 #3
0
        public Action PlayAction(string _actionHelperName)
        {
            ActionHelperStorage actionHelperStorage = null;

            if (!this.actionHelperMap.TryGetValue(_actionHelperName, out actionHelperStorage))
            {
                return(null);
            }
            actionHelperStorage.autoPlay = true;
            return(actionHelperStorage.PlayAction());
        }
コード例 #4
0
        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();
                        }
                    }
                }
            }
        }
コード例 #5
0
        public Action PlayAction(int index)
        {
            if (index < 0 || index > this.actionHelpers.Length)
            {
                return(null);
            }
            ActionHelperStorage actionHelperStorage = this.actionHelpers[index];

            if (actionHelperStorage == null)
            {
                return(null);
            }
            actionHelperStorage.autoPlay = true;
            return(actionHelperStorage.PlayAction());
        }
コード例 #6
0
        public Action PlayAction(int index)
        {
            if ((index < 0) || (index > this.actionHelpers.Length))
            {
                return(null);
            }
            ActionHelperStorage storage = this.actionHelpers[index];

            if (storage == null)
            {
                return(null);
            }
            storage.autoPlay = true;
            return(storage.PlayAction());
        }
コード例 #7
0
 private void Start()
 {
     this.animator = base.gameObject.GetComponent <Animator>();
     this.actionHelperMap.Clear();
     ActionHelperStorage[] array = this.actionHelpers;
     for (int i = 0; i < array.Length; i++)
     {
         ActionHelperStorage actionHelperStorage = array[i];
         this.actionHelperMap.Add(actionHelperStorage.helperName, actionHelperStorage);
         actionHelperStorage.autoPlay = true;
         if (actionHelperStorage.playOnStart)
         {
             actionHelperStorage.PlayAction();
         }
     }
 }
コード例 #8
0
 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();
                 }
             }
         }
     }
 }