using UnityEngine;
using System.Collections;

public class AttackTrigger : MonoBehaviour {
	public GUIController gui;
	// Use this for initialization
	void Start () {
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnTriggerStay(Collider other) {
		PlayerController player = transform.parent.gameObject.transform.parent.GetComponent<PlayerController>();
		if( player.IsAttacking() ){
			if( other.gameObject.tag == "Enemy" ){ 
				Destroy(other.gameObject.transform.parent.gameObject); 
				if( player.GetCurrentRoom() == 2 ){ 
					gui.lootDialog = true;
				}
			}
		}
	}
}
