private void Fire() { if (ShotCooldown > 0) { return; } FiredShot shot = Instantiate(MinigunShotPrefab); shot.transform.SetPositionAndRotation(transform.position, transform.rotation); shot.Fire(ShotSpeed, Vector2.up); ShotCooldown = timeBetweenShots; }
private IEnumerator FireBurst() { InCooldown = true; for (int i = 0; i < shotsPerBurst; i++) { FiredShot shot = Instantiate(LaserShotPrefab); shot.transform.SetPositionAndRotation(transform.position, transform.rotation); shot.Fire(ShotSpeed, aimDirection); yield return(new WaitForSeconds(timeBetweenShots)); } StartCoroutine(Cooldown()); yield return(null); }