Exemplo n.º 1
0
        public void RemoveTempObject(Action.PlaySpeedAffectedType type, GameObject obj)
        {
            if (this.tempObjsAffectedByPlaySpeed == null)
            {
                return;
            }
            ListView <GameObject> listView = null;

            if (this.tempObjsAffectedByPlaySpeed.TryGetValue((uint)type, out listView))
            {
                listView.Remove(obj);
            }
        }
Exemplo n.º 2
0
        private void UpdateTempObjectSpeed()
        {
            if (this.tempObjsAffectedByPlaySpeed == null)
            {
                return;
            }
            float single = this.playSpeed.single;

            DictionaryView <uint, ListView <GameObject> > .Enumerator enumerator = this.tempObjsAffectedByPlaySpeed.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KeyValuePair <uint, ListView <GameObject> > current = enumerator.Current;
                Action.PlaySpeedAffectedType key = (Action.PlaySpeedAffectedType)current.get_Key();
                KeyValuePair <uint, ListView <GameObject> > current2 = enumerator.Current;
                ListView <GameObject> value = current2.get_Value();
                int count = value.Count;
                for (int i = 0; i < count; i++)
                {
                    GameObject gameObject = value[i];
                    if (key == Action.PlaySpeedAffectedType.ePSAT_Anim)
                    {
                        Animation[] componentsInChildren = gameObject.GetComponentsInChildren <Animation>();
                        if (componentsInChildren != null)
                        {
                            for (int j = 0; j < componentsInChildren.Length; j++)
                            {
                                Animation animation = componentsInChildren[j];
                                if (animation.playAutomatically && animation.clip)
                                {
                                    AnimationState animationState = animation[animation.clip.name];
                                    if (animationState)
                                    {
                                        animationState.speed = single;
                                    }
                                }
                            }
                        }
                        Animator[] componentsInChildren2 = gameObject.GetComponentsInChildren <Animator>();
                        if (componentsInChildren2 != null)
                        {
                            for (int k = 0; k < componentsInChildren2.Length; k++)
                            {
                                Animator animator = componentsInChildren2[k];
                                animator.speed = single;
                            }
                        }
                    }
                    else if (key == Action.PlaySpeedAffectedType.ePSAT_Fx)
                    {
                        ParticleSystem[] componentsInChildren3 = gameObject.GetComponentsInChildren <ParticleSystem>();
                        if (componentsInChildren3 != null)
                        {
                            for (int l = 0; l < componentsInChildren3.Length; l++)
                            {
                                ParticleSystem particleSystem = componentsInChildren3[l];
                                particleSystem.set_playbackSpeed(single);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void AddTempObject(Action.PlaySpeedAffectedType type, GameObject obj)
        {
            if (this.tempObjsAffectedByPlaySpeed == null)
            {
                this.tempObjsAffectedByPlaySpeed = new DictionaryView <uint, ListView <GameObject> >();
            }
            ListView <GameObject> listView = null;

            if (!this.tempObjsAffectedByPlaySpeed.TryGetValue((uint)type, out listView))
            {
                listView = new ListView <GameObject>(8);
                this.tempObjsAffectedByPlaySpeed.Add((uint)type, listView);
            }
            for (int i = 0; i < listView.Count; i++)
            {
                GameObject x = listView[i];
                if (x == obj)
                {
                    return;
                }
            }
            listView.Add(obj);
            float single = this.playSpeed.single;

            if (type == Action.PlaySpeedAffectedType.ePSAT_Anim)
            {
                Animation[] componentsInChildren = obj.GetComponentsInChildren <Animation>();
                if (componentsInChildren != null)
                {
                    for (int j = 0; j < componentsInChildren.Length; j++)
                    {
                        Animation animation = componentsInChildren[j];
                        if (animation.playAutomatically && animation.clip)
                        {
                            AnimationState animationState = animation[animation.clip.name];
                            if (animationState)
                            {
                                animationState.speed = single;
                            }
                        }
                    }
                }
                Animator[] componentsInChildren2 = obj.GetComponentsInChildren <Animator>();
                if (componentsInChildren2 != null)
                {
                    for (int k = 0; k < componentsInChildren2.Length; k++)
                    {
                        Animator animator = componentsInChildren2[k];
                        animator.speed = single;
                    }
                }
            }
            else
            {
                ParticleSystem[] componentsInChildren3 = obj.GetComponentsInChildren <ParticleSystem>();
                if (componentsInChildren3 != null)
                {
                    for (int l = 0; l < componentsInChildren3.Length; l++)
                    {
                        ParticleSystem particleSystem = componentsInChildren3[l];
                        particleSystem.set_playbackSpeed(single);
                    }
                }
            }
        }