using UnityEngine;

public class SparkContainerScript : MonoBehaviour {
    public void Bolt()
    {
        var euler = transform.eulerAngles;
        euler.z = Random.Range(-45.0f, 45.0f);
        transform.eulerAngles = euler;
        EnableAll();
        Invoke("DisableAll", 0.2f);
        
    }
    public void EnableAll()
    {
        SetAll(true);
    }

    public void DisableAll()
    {
        SetAll(false);
    }
    private void SetAll(bool enabled)
    {
        foreach(var spark in GetComponentsInChildren<MeshRenderer>())
        {
            Debug.Log("spark");
            spark.enabled = enabled;
        }
    }
}
