I’m trying to shorten this code in someway. Any tips?
else if (bulletType == BulletType.DoubleShot && currentDoubleShotAmmo > 0) {
nextFire = Time.time + DoubleShotRate;
var doubleShot1 = Instantiate (Projectile, ProjectilePos.position, Quaternion.identity);
var doubleShot2 = Instantiate (Projectile, ProjectilePos.position, Quaternion.identity);
Vector2 temp = ProjectilePos.transform.position;
doubleShot2.transform.position = temp;
doubleShot2.transform.Translate (FirstBulletTranslateX, FirstBulletTranslateY, 0, Space.World);
doubleShot1.transform.position = temp;
doubleShot1.transform.Translate (SecondBulletTranslateX, SecondBulletTranslateY, 0, Space.World);
currentDoubleShotAmmo--;
}
Basically what the code does is this
https://giphy.com/gifs/xT9IggCIpxiJiABLtC/html5
I’m just wondering if theres a shorter way to do it without making a new class, but just instead of all this lines of code, lessen it to a few.