CD-ROOM/Assets/Scripts/Particles/FireChildSystems.cs
Gerard Gascón 341a877b4a init
2025-04-24 17:37:25 +02:00

34 lines
765 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireChildSystems : MonoBehaviour
{
public bool destroyOnEnd = true;
public string soundKey = "";
[ContextMenu("Fire Shurikens")]
void fireChildParticles()
{
foreach(ParticleSystem ps in GetComponentsInChildren<ParticleSystem>())
{
ps.Play();
}
if (soundKey.Length != 0)
AudioManager.instance.PlayOneShot(soundKey);
}
private void Start()
{
fireChildParticles();
Invoke(nameof(Autodestroy), 4);
}
void Autodestroy()
{
if (destroyOnEnd)
Destroy(gameObject);
else
gameObject.SetActive(false);
}
}