using UnityEngine;
using System.Collections;

public class BreakableDoor : MonoBehaviour {
	[SerializeField]
	GameObject robot;
	private Robot r;
	// Use this for initialization
	void Start () {
		r = robot.GetComponent<Robot>();
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnTriggerEnter(Collider other)
	{
		if (other.tag == "Hammer" && gameObject.activeSelf && r.isAttacking())
		{
			gameObject.SetActive (false);
			if (GetComponent<Objective>())
			    GetComponent<Objective>().objective = true;
		}
	}
}
