You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.5 KiB

using System;
using System.Collections.Generic;
using FX;
using UnityEngine;
namespace MU3
{
// Token: 0x02000725 RID: 1829
public class AutoPushToCacheParticle_Off : MonoBehaviour
{
// Token: 0x06002F51 RID: 12113 RVA: 0x000FC688 File Offset: 0x000FC688
private void OnEnable()
{
this.time_ = 0f;
this.particleSystems_ = EffectListResource.popParticleSystems();
this.particleSystemsAutoDistroy_ = EffectListResource.popParticleSystems();
base.GetComponentsInChildren<ParticleSystem>(this.particleSystems_);
int num = this.particleSystems_.Count - 1;
while (0 <= num)
{
this.particleSystems_[num].Stop(true, ParticleSystemStopBehavior.StopEmitting);
FX_Destroy component = this.particleSystems_[num].GetComponent<FX_Destroy>();
if (null != component)
{
component.enabled = false;
this.particleSystems_[num].gameObject.SetActive(false);
this.particleSystemsAutoDistroy_.Add(this.particleSystems_[num]);
this.particleSystems_.RemoveAt(num);
}
num--;
}
}
// Token: 0x06002F52 RID: 12114 RVA: 0x000FC754 File Offset: 0x000FC754
private void OnDisable()
{
EffectListResource.pushParticleSystems(ref this.particleSystems_);
EffectListResource.pushParticleSystems(ref this.particleSystemsAutoDistroy_);
}
// Token: 0x06002F53 RID: 12115 RVA: 0x000FC76C File Offset: 0x000FC76C
private void Update()
{
if (this.time_ < this.duration_)
{
this.time_ += Time.deltaTime;
return;
}
int num = 0;
for (int i = 0; i < this.particleSystems_.Count; i++)
{
num += this.particleSystems_[i].particleCount;
}
if (num <= 0)
{
if (this.objectCache_ == null)
{
UnityEngine.Object.Destroy(base.gameObject);
}
else
{
for (int j = 0; j < this.particleSystems_.Count; j++)
{
this.particleSystems_[j].Play(true);
}
for (int k = 0; k < this.particleSystemsAutoDistroy_.Count; k++)
{
this.particleSystemsAutoDistroy_[k].gameObject.SetActive(true);
}
base.enabled = false;
this.objectCache_.push(base.gameObject);
}
}
}
// Token: 0x040054D0 RID: 21712
[SerializeField]
private float duration_;
// Token: 0x040054D1 RID: 21713
public ObjectCache objectCache_;
// Token: 0x040054D2 RID: 21714
private float time_;
// Token: 0x040054D3 RID: 21715
private List<ParticleSystem> particleSystems_;
// Token: 0x040054D4 RID: 21716
private List<ParticleSystem> particleSystemsAutoDistroy_;
}
}