ue4-粒子延时显示

实现粒子延迟效果


延迟逻辑

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 UParticleSystem* ps = UResMgr:: GetInstance()->GetParticle (_ele-> mResId);
UParticleSystemComponent* psComp = nullptr;

psComp = ps != nullptr ?
UGameplayStatics::SpawnEmitterAttached (ps
, _target->GetMesh ()
, FName(* (_ele-> mBindPoint))
, _ele->mLoc
, _ele->mRotate ) : nullptr;

if (ps != nullptr && psComp != nullptr )
{
if (_ele ->mDelayTime > 0. f) //延时可见
{
psComp->SetVisibility (false);
psComp->CustomTimeDilation = 0.f;
}
else
{
psComp->SetVisibility (true);
psComp->CustomTimeDilation = 1.f;
}

psComp->SetRelativeScale3D (_ele-> mScale);

if (_isDurable )
{
int32 newUuid = ::IdGeneratorEffect();
_dstUuids.Add (newUuid);

//TODO 遍历中增加可能有问题,待验证
_bindArr.Add (FEffectBind( _ele, _time , newUuid, psComp));
}
}