31 lines
502 B
C#
31 lines
502 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class WeaponScript : MonoBehaviour
|
|
{
|
|
|
|
public GameObject parent;
|
|
public GameObject bullet;
|
|
|
|
|
|
public void shoot(){
|
|
if(Input.GetKeyDown(KeyCode.Mouse0)){
|
|
Instantiate(bullet,transform.position,parent.transform.rotation);
|
|
}
|
|
|
|
|
|
}
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
shoot();
|
|
}
|
|
}
|