Пуля теперь может врезаться в другую башню

This commit is contained in:
2026-06-07 02:44:02 +03:00
parent 6131e20242
commit 06ba27da72
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -94,6 +94,12 @@ public class Turret : MonoBehaviour
_reloadTimer += Time.deltaTime;
}
private void OnTriggerEnter(Collider other)
{
if (other.TryGetComponent(out TurretBullet bullet) && bullet.From != this)
Destroy(bullet.gameObject);
}
private void SpawnBullet(Vector3 direction)
{
if (_reloadTimer < _reloadTime || !DetectEnemy(direction))