Skip to content
Permalink
c222c96d18
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
27 lines (19 sloc) 661 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyWeapon : MonoBehaviour
{
public GameObject shot;
public Transform shotSpawn;
public float fireRate;
public float delay;
private AudioSource audioSource;
void Start() //allows the enemy to fire its weapon, determines how fast it should fire the bullets, and has it repeat everytime.
{
InvokeRepeating("Fire", delay, fireRate); //repeats command every time
}
void Fire() //what to do when the enemy fires a bullet
{
Instantiate(shot, shotSpawn.position, shotSpawn.rotation); //spawns bullet
}
}