Esempio n. 1
0
        public void StartExplosionFromQueue(ExploderParams p)
        {
            this.parameters       = p;
            this.processingFrames = 1;
            this.explosionWatch.Reset();
            this.explosionWatch.Start();
            AudioSource component = (AudioSource)p.ExploderGameObject.GetComponent <AudioSource>();

            if (Object.op_Implicit((Object)component))
            {
                ExploderUtils.CopyAudioSource(component, this.audioSource);
            }
            this.currTaskType = TaskType.Preprocess;
            this.InitTask(this.currTaskType);
            this.RunTask(this.currTaskType, 0.0f);
            if (this.parameters.ThreadOptions == ExploderObject.ThreadOptions.Disabled)
            {
                return;
            }
            this.currTaskType = this.NextTask(this.currTaskType);
            if (this.currTaskType != TaskType.None)
            {
                this.InitTask(this.currTaskType);
                this.RunTask(this.currTaskType, this.parameters.FrameBudget);
            }
            else
            {
                this.explosionWatch.Stop();
                this.queue.OnExplosionFinished(this.parameters.id, this.explosionWatch.ElapsedMilliseconds);
            }
        }
Esempio n. 2
0
        public void StartExplosionFromQueue(ExploderParams p)
        {
            ExploderUtils.Assert(currTaskType == TaskType.None, "Wrong task: " + currTaskType);
            this.parameters  = p;
            processingFrames = 1;
            explosionWatch.Reset();
            explosionWatch.Start();

            var exAudioSource = p.ExploderGameObject.GetComponent <AudioSource>();

            if (exAudioSource)
            {
                ExploderUtils.CopyAudioSource(exAudioSource, audioSource);
            }

            //
            // do preprocess right away
            //
            currTaskType = TaskType.Preprocess;
            InitTask(currTaskType);
            RunTask(currTaskType);

            if (parameters.ThreadOptions != ExploderObject.ThreadOptions.Disabled)
            {
                currTaskType = NextTask(currTaskType);

                if (currTaskType != TaskType.None)
                {
                    InitTask(currTaskType);
                    RunTask(currTaskType, parameters.FrameBudget);
                }
                else
                {
                    explosionWatch.Stop();
                    queue.OnExplosionFinished(parameters.id, explosionWatch.ElapsedMilliseconds);
                }
            }
        }