From bac1c0227d11113e7ccb246c19851854a34fdd9f Mon Sep 17 00:00:00 2001 From: teascade Date: Thu, 22 Aug 2019 20:26:55 +0300 Subject: [PATCH] Fix Gun Dropper bug --- Assets/Scripts/Environment/GunDropper.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Environment/GunDropper.cs b/Assets/Scripts/Environment/GunDropper.cs index 43760de..afb7193 100644 --- a/Assets/Scripts/Environment/GunDropper.cs +++ b/Assets/Scripts/Environment/GunDropper.cs @@ -41,6 +41,9 @@ namespace Saltosion.OneWeapon.Environment { } public void ExpelGun() { + if (GunsLeft <= 0) { + return; + } GameObject Gun = PossibleGuns[Util.RandomValueBetween(0, PossibleGuns.Count - 1)]; GameObject ShotGun = GameObject.Instantiate(Gun, HoleTransform.position, new Quaternion()); Rigidbody2D Body = ShotGun.GetComponent(); @@ -58,9 +61,8 @@ namespace Saltosion.OneWeapon.Environment { if (GunsLeft == 0) { if (ExplodeOnEmpty) { Explodable.Explode(true); - } else { - Destroy(this); } + Destroy(this); } } }