public void StopAction(Action _action)
 {
     if (_action != null)
     {
         _action.Stop(true);
     }
 }
        public void StopAllActions()
        {
            if (this.actionList.Count == 0)
            {
                return;
            }
            ListView <Action> listView = new ListView <Action>(this.actionList);

            for (int i = 0; i < listView.Count; i++)
            {
                Action action = listView[i];
                action.Stop(true);
            }
        }
Exemplo n.º 3
0
        public override void Process(Action _action, Track _track)
        {
            List <GameObject> list = new List <GameObject>();

            int[] array = this.gameObjectIds;
            for (int i = 0; i < array.Length; i++)
            {
                int index = array[i];
                list.Add(_action.GetGameObject(index));
            }
            ListView <Action> listView = new ListView <Action>();

            using (List <GameObject> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    GameObject current = enumerator.get_Current();
                    using (ListView <Action> .Enumerator enumerator2 = ActionManager.Instance.objectReferenceSet.get_Item(current).GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            Action current2 = enumerator2.get_Current();
                            if (current2 != _action && !current2.unstoppable)
                            {
                                listView.Add(current2);
                            }
                        }
                    }
                }
            }
            using (ListView <Action> .Enumerator enumerator3 = listView.GetEnumerator())
            {
                while (enumerator3.MoveNext())
                {
                    Action current3 = enumerator3.get_Current();
                    current3.Stop(false);
                }
            }
        }
        private Action InternalPlayAction(string _actionName, bool _autoPlay, bool _stopConflictAction, GameObject[] _gameObjects)
        {
            GameObject gameObject = null;

            for (int i = 0; i < _gameObjects.Length; i++)
            {
                GameObject gameObject2 = _gameObjects[i];
                if (!(gameObject2 == null) && this.objectReferenceSet.ContainsKey(gameObject2))
                {
                    gameObject = gameObject2;
                    break;
                }
            }
            if (gameObject && _stopConflictAction)
            {
                this.conflictActionsToStop.Clear();
                ListView <Action>             listView   = this.objectReferenceSet[gameObject];
                ListView <Action> .Enumerator enumerator = listView.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    Action current = enumerator.Current;
                    if (!current.unstoppable)
                    {
                        this.conflictActionsToStop.Add(current);
                    }
                }
                ListView <Action> .Enumerator enumerator2 = this.conflictActionsToStop.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    Action current2 = enumerator2.Current;
                    current2.Stop(false);
                }
            }
            Action action = this.LoadActionResource(_actionName);

            if (action == null)
            {
                Debug.LogError("Playing \"" + _actionName + "\" failed. Asset not found!");
                return(null);
            }
            Action action2 = ClassObjPool <Action> .Get();

            action2.enabled             = _autoPlay;
            action2.refGameObjectsCount = _gameObjects.Length;
            action2.LoadAction(action, _gameObjects);
            this.actionList.Add(action2);
            for (int j = 0; j < _gameObjects.Length; j++)
            {
                GameObject gameObject3 = _gameObjects[j];
                if (!(gameObject3 == null))
                {
                    ListView <Action> listView2 = null;
                    if (this.objectReferenceSet.TryGetValue(gameObject3, out listView2))
                    {
                        listView2.Add(action2);
                    }
                    else
                    {
                        listView2 = new ListView <Action>();
                        listView2.Add(action2);
                        this.objectReferenceSet.Add(gameObject3, listView2);
                    }
                }
            }
            return(action2);
        }