using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class shoot : MonoBehaviour {
public GameObject bullet;
public float speed = 5;
private float time = 0;
private float timer = 3;
public GameObject b;
// Use this for initialization
void Start () {
Debug.Log("--Hellow Unity!");
// GameObject.Instantiate(bullet,transform.position,transform.rotation);
}
// Update is called once per frame
void Update () {
if(Input.GetMouseButtonDown(0))
{
b = GameObject.Instantiate(bullet, transform.position, transform.rotation);
Rigidbody rgd = b.GetComponent<Rigidbody>();
rgd.velocity = transform.forward * speed;
}
}
}