How to make bullet shoot in same direction as player faces in 2D Top Down Shooter

I want my bullets to be shot in direction same as my character looks at. Here’s a script I have for bullet so far.

using UnityEngine;
using System.Collections;

public class PlayerShooting : MonoBehaviour {

	public Rigidbody2D bulletPrefab;
	public float attackSpeed = 0.5f;
	public float coolDown;
	public float bulletSpeed = 500;
	public float yValue = 1f; // Used to make it look like it's shot from the gun itself (offset)
	public float xValue = 0.2f; // Same as above

	// Update is called once per frame
	void Update () 
		if(Time.time >= coolDown)

	void Fire()
		//Rigidbody2D bPrefab = Instantiate(bulletPrefab,transform.position,Quaternion.identity) as Rigidbody2D;

		Rigidbody2D bPrefab = Instantiate(bulletPrefab, new Vector3(transform.position.x + xValue, transform.position.y + yValue, transform.position.z), Quaternion.identity) as Rigidbody2D;

		bPrefab.rigidbody2D.AddForce(Vector2.up * bulletSpeed);

		coolDown = Time.time + attackSpeed;

Assuming this script is on the character, you can use this transform to find the direction. First, identify forward for your character when the rotation is (0,0,0). For most 2D game it is either ‘transform.up’ or ‘transform.right’. Then you can change line 33 to:

   bPrefab.rigidbody2D.AddForce(transform.up * bulletSpeed);

Or use ‘transform.right’ if the right of your character is forward.

Assuming the PlayerShooting script is attached to your player GameObject…set the force on your prefab bullet to use the player’s “transform.up” instead of the global “Vector2.up”. (Or you might need to use “transform.right” depending how you’ve oriented your sprite.)