using UnityEngine;
using System.Collections;

public class TakeOut : MonoBehaviour {

    public GameObject from = null;

    private Vector3 _distance;
    private Animator _animator;

	// Use this for initialization
	void Start () {
	    
        if (from != null)
        {
            _distance = from.transform.position - gameObject.transform.position;
        }

	}
	
	// Update is called once per frame
	void Update () {

        if (Mathf.Abs(gameObject.transform.position.y - from.transform.position.y) > 0.1f)
        {
            gameObject.transform.Translate(Vector3.up * 0.4f * Time.deltaTime);
            GetComponent<Animator>().SetInteger("Direction", 1);
        }
        else
        {
            from.GetComponent<MilitarBasic>().TakenOut();
            GetComponent<Animator>().SetInteger("Direction", -1);
            from.GetComponent<Animator>().SetInteger("Direction", -1);
        }

	}
}
