// Use this for initialization
	void Start () {
		
		gv = GameObject.Find ("main").GetComponent<globalVars> ();


		//Make object selected
		//gv = GameObject.Find ("main").GetComponent<globalVars> ();
		gv.selectedObject = this.gameObject;

		//Assign clip from sound bank based on dropdown selection
		mainSource = GetComponent<AudioSource> ();
		mainSource.clip = gv.getSound (gv.soundOptions.value);
		
		//Scale setup
		bc = GetComponent<BoxCollider2D> ();
		clipSize = mainSource.clip.length;
		this.transform.localScale = new Vector3 (clipSize, 1, 1);
		//bc.size = new Vector2 (clipSize, 1);

		//set parent to life side
		//parent = gameObject.transform.parent.gameObject;
		//parent.transform.position = this.transform.position;
		//parent.transform.position = new Vector3 (this.transform.position.x-(clipSize/2), this.transform.position.y, this.transform.position.z);

		//Add self to master list
		List<AudioSource> a =  (List<AudioSource>)gv.allGroups["Master"];
		a.Add (mainSource);

		//handleSnap ();

		//Set default values
		startTime = 0;
		endTime = mainSource.clip.length;

		//Setup guide line
		Debug.Log ("Scale" + this.transform.localScale.x / 2);
		//guideLine.SetPosition (0, new Vector3 (this.transform.localScale.x/2, 10, 0));
		//guideLine.SetPosition (1, new Vector3 (this.transform.localScale.x/2, -10, 0));


		//Previous group settings & master settings
		updateSoundSettings (true);
		//What happens if an effect has already been added
		//will need to check current settings
	}