using System; using UnityEngine.Playables; namespace UnityEngine.Timeline { // Token: 0x02000036 RID: 54 public class ParticleControlPlayable : PlayableBehaviour { // Token: 0x060001D1 RID: 465 RVA: 0x00009800 File Offset: 0x00007A00 public static ScriptPlayable Create(PlayableGraph graph, ParticleSystem component, uint randomSeed) { ScriptPlayable scriptPlayable; if (component == null) { scriptPlayable = ScriptPlayable.Null; } else { ScriptPlayable scriptPlayable2 = ScriptPlayable.Create(graph, 0); scriptPlayable2.GetBehaviour().Initialize(component, randomSeed); scriptPlayable = scriptPlayable2; } return scriptPlayable; } // Token: 0x1700008B RID: 139 // (get) Token: 0x060001D2 RID: 466 RVA: 0x00009844 File Offset: 0x00007A44 public ParticleSystem particleSystem { get { return this.m_ParticleSystem; } } // Token: 0x060001D3 RID: 467 RVA: 0x0000985F File Offset: 0x00007A5F public void Initialize(ParticleSystem particleSystem, uint randomSeed) { this.m_RandomSeed = Math.Max(1U, randomSeed); this.m_ParticleSystem = particleSystem; } // Token: 0x060001D4 RID: 468 RVA: 0x00009878 File Offset: 0x00007A78 public override void PrepareFrame(Playable playable, FrameData data) { if (!(this.particleSystem == null) && this.particleSystem.gameObject.activeInHierarchy) { if (this.particleSystem.randomSeed != this.m_RandomSeed) { this.particleSystem.Stop(); this.particleSystem.useAutoRandomSeed = false; this.particleSystem.randomSeed = this.m_RandomSeed; } float num = (float)playable.GetTime(); bool flag = Mathf.Approximately(this.m_LastTime, -1f) || !Mathf.Approximately(this.m_LastTime, num); if (flag) { float num2 = Time.fixedDeltaTime * 0.5f; float num3 = num; float num4 = num3 - this.m_LastTime; bool flag2 = num3 < this.m_LastTime || num3 < num2 || Mathf.Approximately(this.m_LastTime, -1f) || num4 > this.particleSystem.main.duration || !Mathf.Approximately(this.m_LastPsTime, this.particleSystem.time); if (flag2) { this.particleSystem.Simulate(0f, true, true); this.particleSystem.Simulate(num3, true, false); } else { float num5 = num3 % this.particleSystem.main.duration; float num6 = num5 - this.particleSystem.time; if (num6 < -num2) { num6 = num5 + this.particleSystem.main.duration - this.particleSystem.time; } this.particleSystem.Simulate(num6, true, false); } this.m_LastPsTime = this.particleSystem.time; this.m_LastTime = num; } } } // Token: 0x060001D5 RID: 469 RVA: 0x00009A4F File Offset: 0x00007C4F public override void OnBehaviourPlay(Playable playable, FrameData info) { this.m_LastTime = -1f; } // Token: 0x060001D6 RID: 470 RVA: 0x00009A5D File Offset: 0x00007C5D public override void OnBehaviourPause(Playable playable, FrameData info) { this.m_LastTime = -1f; } // Token: 0x040000D8 RID: 216 private const float kUnsetTime = -1f; // Token: 0x040000D9 RID: 217 private float m_LastTime = -1f; // Token: 0x040000DA RID: 218 private float m_LastPsTime = -1f; // Token: 0x040000DB RID: 219 private uint m_RandomSeed = 1U; // Token: 0x040000DC RID: 220 private ParticleSystem m_ParticleSystem; } }