﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BulletMovement : MonoBehaviour {
	public GameObject player;
	//public Rigidbody2D bullet;

	public float moveTime;
	private float startTime;
	private float moveSpeed;

	// Use this for initialization
	void Start () {
		startTime = Time.time;
		moveTime = 0.25f;
		player = GameObject.FindGameObjectWithTag ("Player");

	}

	// Update is called once per frame
	void Update () {
		Move (); 
		//Destroy (this.gameObject, 3.0f);
	}
	void Move() {
		transform.LookAt (player.transform);
		moveSpeed = (Time.time - startTime) / moveTime;
		transform.position += transform.forward * moveSpeed * Time.deltaTime;
		//this.transform.position = Vector2.Lerp (this.transform.position, player.transform.position, moveSpeed * Time.deltaTime);
	}
}
