using UnityEngine;
using System.Collections;

public class TimerToAttack : MonoBehaviour {


	public int TimeUntilAttack = 180;

	public GameObject RisingTentacleObject;

	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		//Debug.Log (TimeUntilAttack);
		TimeUntilAttack = TimeUntilAttack - 1;
		if (TimeUntilAttack <= 0) 
		{
			Debug.Log ("Tentacle Should Penetrate");
			Instantiate (RisingTentacleObject, transform.position, Quaternion.identity);
			TimeUntilAttack = 3000;
			gameObject.GetComponent<ShadowFollowPlayer> ().speedOfShadowFollowPlayer = gameObject.GetComponent<ShadowFollowPlayer> ().speedOfShadowFollowPlayer - gameObject.GetComponent<ShadowFollowPlayer> ().speedOfShadowFollowPlayer;
			StartCoroutine (DestroyIt ());
		}

	}

	IEnumerator DestroyIt()
	{
		
		yield return new WaitForSeconds (2);
		Destroy (gameObject);
	}
		
}
