using UnityEngine;
using System.Collections;

public class ShotMove : MonoBehaviour
{
	public int damage = 10;
	public bool _isShot = false;
	public int startX, startY;
	public string tag = "ATK_to_Enemy";/*	ATK_to_enemy
											ATK_to_player
										*/

    public Vector2 speed;// new Vector2(6, 4);
	private Vector2 movement;

	private Vector3 pos;
	
	void Start ()
	{
		pos.x = startX;
		pos.y = startY;
		transform.position = pos;
		//pos = transform.position;
	}
	
	void Update()
	{
		if(_isShot)
		{
			speed = new Vector2(6, 4);
            pos = transform.position;
			pos.x = pos.x + speed.x;
			pos.y = pos.y + speed.y;
			
			if(pos.y > 40.0F)	{	Destroy(this.gameObject);		}
			//else				{	transform.position = pos;	}//너무 빨라서 조절 안 됨.
			else				{	movement = new Vector2( pos.x, pos.y);	}
		}
	}
	
	void FixedUpdate()
	{
		// Apply movement to the rigidbody
		GetComponent<Rigidbody2D>().velocity = movement;
	}
}