예제 #1
0
 public void RemoveTempObject(PlaySpeedAffectedType type, GameObject obj)
 {
     if (this.tempObjsAffectedByPlaySpeed != null)
     {
         ListView <GameObject> view = null;
         if (this.tempObjsAffectedByPlaySpeed.TryGetValue((uint)type, out view))
         {
             view.Remove(obj);
         }
     }
 }
예제 #2
0
        private void UpdateTempObjectSpeed()
        {
            if (this.tempObjsAffectedByPlaySpeed != null)
            {
                float single = this.playSpeed.single;
                DictionaryView <uint, ListView <GameObject> > .Enumerator enumerator = this.tempObjsAffectedByPlaySpeed.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    KeyValuePair <uint, ListView <GameObject> > current = enumerator.Current;
                    PlaySpeedAffectedType key = current.Key;
                    KeyValuePair <uint, ListView <GameObject> > pair2 = enumerator.Current;
                    ListView <GameObject> view = pair2.Value;
                    int count = view.Count;
                    for (int i = 0; i < count; i++)
                    {
                        GameObject obj2 = view[i];
                        switch (key)
                        {
                        case PlaySpeedAffectedType.ePSAT_Anim:
                        {
                            Animation[] componentsInChildren = obj2.GetComponentsInChildren <Animation>();
                            if (componentsInChildren != null)
                            {
                                for (int j = 0; j < componentsInChildren.Length; j++)
                                {
                                    Animation animation = componentsInChildren[j];
                                    if (animation.playAutomatically && (animation.clip != null))
                                    {
                                        AnimationState state = animation[animation.clip.name];
                                        if (state != null)
                                        {
                                            state.speed = single;
                                        }
                                    }
                                }
                            }
                            Animator[] animatorArray = obj2.GetComponentsInChildren <Animator>();
                            if (animatorArray != null)
                            {
                                for (int k = 0; k < animatorArray.Length; k++)
                                {
                                    Animator animator = animatorArray[k];
                                    animator.speed = single;
                                }
                            }
                            break;
                        }

                        case PlaySpeedAffectedType.ePSAT_Fx:
                        {
                            ParticleSystem[] systemArray = obj2.GetComponentsInChildren <ParticleSystem>();
                            if (systemArray != null)
                            {
                                for (int m = 0; m < systemArray.Length; m++)
                                {
                                    ParticleSystem system = systemArray[m];
                                    system.playbackSpeed = single;
                                }
                            }
                            break;
                        }
                        }
                    }
                }
            }
        }
예제 #3
0
        public void AddTempObject(PlaySpeedAffectedType type, GameObject obj)
        {
            if (this.tempObjsAffectedByPlaySpeed == null)
            {
                this.tempObjsAffectedByPlaySpeed = new DictionaryView <uint, ListView <GameObject> >();
            }
            ListView <GameObject> view = null;

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

            if (type == 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 != null))
                        {
                            AnimationState state = animation[animation.clip.name];
                            if (state != null)
                            {
                                state.speed = single;
                            }
                        }
                    }
                }
                Animator[] animatorArray = obj.GetComponentsInChildren <Animator>();
                if (animatorArray != null)
                {
                    for (int k = 0; k < animatorArray.Length; k++)
                    {
                        Animator animator = animatorArray[k];
                        animator.speed = single;
                    }
                }
            }
            else
            {
                ParticleSystem[] systemArray = obj.GetComponentsInChildren <ParticleSystem>();
                if (systemArray != null)
                {
                    for (int m = 0; m < systemArray.Length; m++)
                    {
                        ParticleSystem system = systemArray[m];
                        system.playbackSpeed = single;
                    }
                }
            }
        }