Better handling stopping/resetting non-looping effect.
This commit is contained in:
@@ -283,11 +283,8 @@ void ParticleEffect::UpdateSimulation(bool singleFrame)
|
||||
|
||||
void ParticleEffect::Play()
|
||||
{
|
||||
// Reset simulation when play is called and particle system is time is complete - ex. if IsLooping is false and simulation is complete
|
||||
if (!IsLooping && Instance.Time >= (float)ParticleSystem->DurationFrames / ParticleSystem->FramesPerSecond)
|
||||
ResetSimulation();
|
||||
|
||||
_isPlaying = true;
|
||||
_isStopped = false;
|
||||
}
|
||||
|
||||
void ParticleEffect::Pause()
|
||||
@@ -297,6 +294,7 @@ void ParticleEffect::Pause()
|
||||
|
||||
void ParticleEffect::Stop()
|
||||
{
|
||||
_isStopped = true;
|
||||
_isPlaying = false;
|
||||
ResetSimulation();
|
||||
}
|
||||
@@ -452,7 +450,7 @@ void ParticleEffect::Update()
|
||||
void ParticleEffect::UpdateExecuteInEditor()
|
||||
{
|
||||
// Auto-play in Editor
|
||||
if (!Editor::IsPlayMode)
|
||||
if (!Editor::IsPlayMode && !_isStopped)
|
||||
{
|
||||
_isPlaying = true;
|
||||
Update();
|
||||
|
||||
Reference in New Issue
Block a user