using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shooting : MonoBehaviour {
public GameObject theBullet;
public Transform barrelEnd;
public int bulletSpeed;
private void Update ()
{
if(Input.GetKey (KeyCode.Mouse0))
{
Shoot();
}
}
void Shoot ()
{
var bullet = Instantiate (theBullet, barrelEnd.position, barrelEnd.rotation);
bullet.GetComponent().velocity = bullet.;transform.foward * bulletSpeed;
}
}