using UnityEngine;
using System.Collections;

public class SnakeAnimationController : MonoBehaviour 
{
	public Transform playerTransform;
	
	private Transform myTransform;
	private Animator anim;
	
	// Use this for initialization
	void Start () 
	{
		anim = GetComponent<Animator>();
		myTransform = transform;
	}
	
	// Update is called once per frame
	void Update () 
	{
		float distance = Mathf.Abs(playerTransform.position.x - myTransform.position.x);
		anim.SetFloat("playerDistance", distance);

//		Debug.Log("current snake animation: " + anim.GetCurrentAnimationClipState(0)[0].clip.name);
	}

	void DestroySnake()
	{
		GameObject.Destroy(gameObject);
	}
}
