using System;
using UnityEngine;

public class DanceIntervalDelete : MonoBehaviour
{
	public bool IsEnd
	{
		get
		{
			return this.m_IsEnd;
		}
	}

	protected virtual void Start()
	{
		RhythmAction_Mgr.Instance.AddParticleSystem(this.particleArray);
		RhythmAction_Mgr.Instance.AddAudioMgr(this.audioArray);
		base.StartCoroutine(RhythmAction_Mgr.Instance.DanceTimeCoroutine(this.DeleteTime, new Action<float>(this.UpdataCall), new Action(this.EndCall)));
	}

	protected virtual void OnDestroy()
	{
		this.EndCall();
	}

	protected virtual void UpdataCall(float timer)
	{
	}

	public virtual void EndCall()
	{
		if (this.m_IsEnd)
		{
			return;
		}
		if (RhythmAction_Mgr.Instance)
		{
			RhythmAction_Mgr.Instance.RemoveParticleSystem(this.particleArray);
			RhythmAction_Mgr.Instance.RemoveAudioMgr(this.audioArray);
		}
		this.m_IsEnd = true;
		UnityEngine.Object.Destroy(base.gameObject);
	}

	public float DeleteTime = 3f;

	public ParticleSystem[] particleArray;

	public AudioSource[] audioArray;

	protected bool m_IsEnd;
}
