From fe8ff701d2a2dcb2d3f8062093d74ad91c708b5b Mon Sep 17 00:00:00 2001 From: kittyegg Date: Sun, 17 May 2026 01:32:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D1=83=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=D0=B0=D1=80=D1=8F=D0=B4=D0=BA=D0=B8=20=D1=82=D1=83=D1=80?= =?UTF-8?q?=D1=80=D0=B5=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Turret.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/Turret.cs b/Assets/Scripts/Turret.cs index fcd68aa..f0867c1 100644 --- a/Assets/Scripts/Turret.cs +++ b/Assets/Scripts/Turret.cs @@ -15,27 +15,23 @@ public class Turret : MonoBehaviour private void Update() { - if (_reloadTimer >= _reloadTime) - { - SpawnBullet(Vector3.forward); - SpawnBullet(Vector3.back); - SpawnBullet(Vector3.left); - SpawnBullet(Vector3.right); - - _reloadTimer = 0f; - } - + SpawnBullet(Vector3.forward); + SpawnBullet(Vector3.back); + SpawnBullet(Vector3.left); + SpawnBullet(Vector3.right); + _reloadTimer += Time.deltaTime; } private void SpawnBullet(Vector3 direction) { - if (!DetectEnemy(direction)) + if (_reloadTimer < _reloadTime || !DetectEnemy(direction)) return; - + var rot = transform.rotation; rot.SetLookRotation(direction); Instantiate(_bulletPrefab, transform.position, rot, transform); + _reloadTimer = 0f; } private bool DetectEnemy(Vector3 direction) =>