public void EmitParticle() { var nextIdx = GetNextParticleIdx(); if (nextIdx == -1) { return; } Parts[nextIdx] = PartStorage[nextIdx]; //if (Parts[nextIdx] == null) // check if index exists? //return; var firstParticle = Info.TotalParticles == 0 && Info.TotalSeconds == 0.0f; var randomOffset = Info.GetRandomOffset(); var randomA = Info.GetRandomA(); var randomB = Info.GetRandomB(); var randomC = Info.GetRandomC(); Particles[nextIdx].Init(Info, Parent, PartIndex, ParentOffset, Parts[nextIdx], randomOffset, firstParticle, randomA, randomB, randomC); PhysicsObj.AddPartToShadowCells(Parts[nextIdx]); RecordParticleEmission(); }