using System.Collections; using System.Collections.Generic; using UnityEngine; public class SpawnBullets : MonoBehaviour { public GameObject bulletPrefab; public Transform spawnPoint; public bool bShock; public float coneAngle = 1.5f; private int count = 0; public double frequence = 0.5f; private GameObject go; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Time.time > (count * frequence)) { if (bShock) { Quaternion coneRandomRotation = Quaternion.Euler(Random.Range(-coneAngle, coneAngle), Random.Range(-coneAngle, coneAngle), 0); go=Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation * coneRandomRotation); } count++; } } public void SetOn() { bShock = true; } }