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

public class MachineGunBullet : BaseBullet {

	[Header("Values")]
	public float speed = 12;
	public float lifeTime = 2;

	float timeCounter = 0;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void FixedUpdate () {
		Vector2 targetPosition = transform.position + ( transform.right * speed );
		transform.position = Vector2.MoveTowards(transform.position, targetPosition, Time.fixedDeltaTime * speed);

		if (timeCounter >= lifeTime)
		{
			gameObject.SetActive(false);
			Destroy(gameObject);
		}
		else
		{
			timeCounter += Time.fixedDeltaTime;
		}
	}


}
