ShootSuff.cs 373 Bytes
Newer Older
Swado95's avatar
Swado95 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
using UnityEngine;
using System.Collections;

public class ShootSuff : MonoBehaviour {

   

    public void Shoot(GameObject bul, Vector2 dir, float force = 1)
    {

        GameObject go = Instantiate(bul, transform.position, transform.rotation) as GameObject;

        Rigidbody2D rb2d = go.GetComponent<Rigidbody2D>();

        rb2d.AddForce(dir * force);

    }
}