using UnityEngine;
using System.Collections;

public class ButtonController : MonoBehaviour, IInteractable {

	[SerializeField]
	private GameObject DoorLockCollider = null; //Child collider connected to a locked door
	[SerializeField]
	private GameObject DoorObject = null; //Door gameObject
	[SerializeField]
	private Sprite DoorUnlockedSprite = null;
	[SerializeField]
	private Sprite PressedSprite = null; //Sprite when button is on
	[SerializeField]
	AudioClip UnlockDoor = null;


	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () 
	{
	
	}

	public void Interact()
	{
		Debug.Log ("Button hit");
		SpriteRenderer currentRenderer = GetComponent<SpriteRenderer> ();
		currentRenderer.sprite = PressedSprite;
		DoorObject.GetComponent<SpriteRenderer> ().sprite = DoorUnlockedSprite;
		DoorLockCollider.SetActive (false);
		Camera.main.GetComponent<AudioController> ().PlaySoundEffect (UnlockDoor);
	}
}
