20 lines
463 B
C#
20 lines
463 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class WeaponController : MonoBehaviour {
|
|
public GameObject shot;
|
|
public Transform shotSpawn;
|
|
public float fireRate, delay;
|
|
private AudioSource audioSource;
|
|
void Start ()
|
|
{
|
|
audioSource = GetComponent<AudioSource>();
|
|
InvokeRepeating("Fire", delay, fireRate);
|
|
}
|
|
void Fire()
|
|
{
|
|
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
|
|
audioSource.Play();
|
|
}
|
|
} |