using UnityEngine;
using System.Collections;

public class KrakenTakeDamageScript : MonoBehaviour {

	GameObject gameManager;
	Animator anim;

	// Use this for initialization
	void Start () {
		anim = GetComponent<Animator> ();
		gameManager = GameObject.Find ("GameManager");
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnTriggerEnter2D(Collider2D col)
	{
		Debug.Log ("Collision");
		if (col.gameObject.tag == "Harpoon") 
		{
			Debug.Log ("Collision w/harpoon");
			gameManager.GetComponent<GameManagerScript> ().KrakenTakeDamageFromHarpoon ();
			if (gameManager.GetComponent<GameManagerScript> ().KrakenHealth <= 7000) 
			{
				anim.SetTrigger ("KrakenEscape");
			}

		}
	}

	public void DESTROYKRAKEN()
	{
		Destroy (gameObject);
		//load next scene
	}
}
