Ejemplo n.º 1
0
        public void Initialize(ExploderObject exploder)
        {
            if (initialized)
            {
                return;
            }

            initialized = true;
            parameters  = new ExploderParams(exploder);

            // init pool
            FragmentPool.Instance.Reset(parameters);
            frameWatch     = new Stopwatch();
            explosionWatch = new Stopwatch();

            crackManager = new CrackManager(this);

            bakeSkinManager = new BakeSkinManager(this);

            //
            // init queue
            //
            queue = new ExploderQueue(this);

            //
            // init tasks
            //
            tasks = new ExploderTask[(int)TaskType.TaskMax];

            tasks[(int)TaskType.Preprocess] = new Preprocess(this);

#if DISABLE_MULTITHREADING
            tasks[(int)TaskType.ProcessCutter] = new CutterST(this);
#else
            if (parameters.ThreadOptions == ExploderObject.ThreadOptions.Disabled)
            {
                tasks[(int)TaskType.ProcessCutter] = new CutterST(this);
            }
            else
            {
                tasks[(int)TaskType.ProcessCutter] = new CutterMT(this);
            }
#endif

            tasks[(int)TaskType.IsolateMeshIslands] = new IsolateMeshIslands(this);
            tasks[(int)TaskType.PostprocessExplode] = new PostprocessExplode(this);
            tasks[(int)TaskType.PostprocessCrack]   = new PostprocessCrack(this);

            PreAllocateBuffers();

            audioSource = gameObject.AddComponent <AudioSource>();
        }
Ejemplo n.º 2
0
 public void Initialize(ExploderObject exploder)
 {
     if (this.initialized)
     {
         return;
     }
     this.initialized = true;
     this.parameters  = new ExploderParams(exploder);
     FragmentPool.Instance.Reset(this.parameters);
     this.frameWatch      = new Stopwatch();
     this.explosionWatch  = new Stopwatch();
     this.crackManager    = new CrackManager(this);
     this.bakeSkinManager = new BakeSkinManager(this);
     this.queue           = new ExploderQueue(this);
     this.tasks           = new ExploderTask[6];
     this.tasks[1]        = (ExploderTask) new Preprocess(this);
     this.tasks[2]        = this.parameters.ThreadOptions != ExploderObject.ThreadOptions.Disabled ? (ExploderTask) new CutterMT(this) : (ExploderTask) new CutterST(this);
     this.tasks[3]        = (ExploderTask) new IsolateMeshIslands(this);
     this.tasks[4]        = (ExploderTask) new PostprocessExplode(this);
     this.tasks[5]        = (ExploderTask) new PostprocessCrack(this);
     this.PreAllocateBuffers();
     this.audioSource = (AudioSource)((Component)this).get_gameObject().AddComponent <AudioSource>();
 }