FireballMove.cs 624 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
using UnityEngine;
using System.Collections;

public class FireballMove : MonoBehaviour {
	public float speed;
	private Rigidbody2D fireRB;
	public int direction;
	public Vector2 move;

	// Use this for initialization
	void Start () {
		fireRB = GetComponent<Rigidbody2D> ();
		/*
		if (direction == 0)
			move = new Vector2 (1,0);
		if (direction == 1)
			move = new Vector2 (0,1);
		if (direction == 2)
			move = new Vector2 (-1,0);
		if (direction == 3)
			move = new Vector2 (0,-1);
			*/
	}

	// Update is called once per frame
	void Update () {
		fireRB.MovePosition((Vector2)transform.position + move*speed);
	}
}