| 44 | } |
| 45 | |
| 46 | ParticleEffect* ParticleEmitter::Spawn(Actor* parent, const Transform& transform, float duration, bool autoDestroy) |
| 47 | { |
| 48 | PROFILE_MEM(Particles); |
| 49 | CHECK_RETURN(!WaitForLoaded(), nullptr); |
| 50 | auto system = Content::CreateVirtualAsset<ParticleSystem>(); |
| 51 | CHECK_RETURN(system, nullptr); |
| 52 | system->Init(this, duration < MAX_float ? duration : 3600.0f); |
| 53 | |
| 54 | auto effect = New<ParticleEffect>(); |
| 55 | effect->SetTransform(transform); |
| 56 | effect->ParticleSystem = system; |
| 57 | |
| 58 | Level::SpawnActor(effect, parent); |
| 59 | |
| 60 | if (autoDestroy && duration < MAX_float) |
| 61 | effect->DeleteObject(duration, true); |
| 62 | |
| 63 | return effect; |
| 64 | } |
| 65 | |
| 66 | void ParticleEmitter::WaitForAsset(Asset* asset) |
| 67 | { |
nothing calls this directly
no test coverage detected