using UnityEngine;
using System.Collections;

public class Rocket : MonoBehaviour {
	Rigidbody2D r_body;
	float rocket_velocity;
	Transform transform;
	Vector2 direction;
	Vector3 mouse_pos;
	// Use this for initialization
	void Start () {
		/*r_body = GetComponent<Rigidbody2D> ();
		rocket_velocity = 50;
		transform = GetComponent<Transform> ();
		//r_body.AddForce(transform.forward * rocket_velocity);
		r_body.velocity =(transform.forward * rocket_velocity);*/
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void FixedUpdate(){
		mouse_pos = Input.mousePosition;
		//direction = (mouse_pos.x, mouse_pos.y);
		r_body = GetComponent<Rigidbody2D> ();
		rocket_velocity = 1000;
		transform = GetComponent<Transform> ();
		//r_body.AddForce(transform.forward * rocket_velocity);
		//r_body.velocity =(direction * rocket_velocity);
	}

	public void ShootDirection(Vector3 dir)
	{
		Debug.Log (dir);
		GetComponent<Rigidbody2D>().AddForce (dir.normalized * 1500);
	}
}
