using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChandelierSpawner : MonoBehaviour {

    public GameObject placelist;
    public GameObject spawned;
    public int min;
    public int max;
	
	// Update is called once per frame
	void Start() {
        int amt = Random.Range(min, max + 1);
        for (int i = 0; i < amt; i++) {
            GameObject.Instantiate(spawned,
                placelist.GetComponent<PositionHolderScript>().GetRandomPositionOnce(),
                Quaternion.identity);
            /*FreqFallScript ffs = spawned.GetComponentInChildren<FreqFallScript>();
            FreqSwingScript fss = spawned.GetComponentInChildren<FreqSwingScript>();
            ffs.resonance_frequency = 0;
            fss.resonance_frequency = 0;
            ffs.resonance_note = Random.Range(-13, 25);
            fss.resonance_note = ffs.resonance_note;
            ffs.precision_needed = Random.Range(0.3f, 3f);
            fss.precision_needed = ffs.precision_needed;
            ffs.amplitude_needed = 1;
            fss.amplitude_needed = ffs.amplitude_needed;*/
            FreqExploScript ffs = spawned.GetComponentInChildren<FreqExploScript>();
            FreqSwingScript fss = spawned.GetComponentInChildren<FreqSwingScript>();
            ffs.resonance_frequency = 0;
            fss.resonance_frequency = 0;
            ffs.resonance_note = Random.Range(-13, 25);
            fss.resonance_note = ffs.resonance_note + 1;// Random.Range(-1f,1f);
            ffs.precision_needed = Random.Range(0.5f, 3f);
            fss.precision_needed = ffs.precision_needed;
            ffs.amplitude_needed = 1;
            fss.amplitude_needed = ffs.amplitude_needed;
        }
    }
}


