Fix Gun Dropper bug

This commit is contained in:
Sofia 2019-08-22 20:26:55 +03:00
parent 45b6cf5d9f
commit bac1c0227d

View File

@ -41,6 +41,9 @@ namespace Saltosion.OneWeapon.Environment {
} }
public void ExpelGun() { public void ExpelGun() {
if (GunsLeft <= 0) {
return;
}
GameObject Gun = PossibleGuns[Util.RandomValueBetween(0, PossibleGuns.Count - 1)]; GameObject Gun = PossibleGuns[Util.RandomValueBetween(0, PossibleGuns.Count - 1)];
GameObject ShotGun = GameObject.Instantiate(Gun, HoleTransform.position, new Quaternion()); GameObject ShotGun = GameObject.Instantiate(Gun, HoleTransform.position, new Quaternion());
Rigidbody2D Body = ShotGun.GetComponent<Rigidbody2D>(); Rigidbody2D Body = ShotGun.GetComponent<Rigidbody2D>();
@ -58,10 +61,9 @@ namespace Saltosion.OneWeapon.Environment {
if (GunsLeft == 0) { if (GunsLeft == 0) {
if (ExplodeOnEmpty) { if (ExplodeOnEmpty) {
Explodable.Explode(true); Explodable.Explode(true);
} else { }
Destroy(this); Destroy(this);
} }
} }
} }
}
} }