void Launch() { if (firelevel == 1) { GameObject projectileObject = Instantiate(bullet, rigidbody2d.position + Vector2.up * 0.2f, Quaternion.identity); bullet1 projectile = projectileObject.GetComponent <bullet1>(); projectile.Launch(Vector2.up, 200); } if (firelevel == 2) { Vector2 newpos1 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.right * 0.1f; Vector2 newpos2 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.left * 0.1f; GameObject projectileObject2 = Instantiate(bullet, newpos1, Quaternion.identity); bullet1 projectile2 = projectileObject2.GetComponent <bullet1>(); projectile2.Launch(Vector2.up, 200); GameObject projectileObject3 = Instantiate(bullet, newpos2, Quaternion.identity); bullet1 projectile3 = projectileObject3.GetComponent <bullet1>(); projectile3.Launch(Vector2.up, 200); } if (firelevel == 3) { GameObject projectileObject = Instantiate(bullet, rigidbody2d.position + Vector2.up * 0.2f, Quaternion.identity); bullet1 projectile = projectileObject.GetComponent <bullet1>(); projectile.Launch(Vector2.up, 200); Vector2 newpos1 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.right * 0.1f; Vector2 newpos2 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.left * 0.1f; GameObject projectileObject2 = Instantiate(bullet, newpos1, Quaternion.identity); bullet1 projectile2 = projectileObject2.GetComponent <bullet1>(); projectile2.Launch(Vector2.up, 200); GameObject projectileObject3 = Instantiate(bullet, newpos2, Quaternion.identity); bullet1 projectile3 = projectileObject3.GetComponent <bullet1>(); projectile3.Launch(Vector2.up, 200); } if (firelevel == 4) { GameObject projectileObject = Instantiate(bullet2, rigidbody2d.position + Vector2.up * 0.2f, Quaternion.identity); bullet1 projectile = projectileObject.GetComponent <bullet1>(); projectile.Launch(Vector2.up, 200); Vector2 newpos1 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.right * 0.1f; Vector2 newpos2 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.left * 0.1f; GameObject projectileObject2 = Instantiate(bullet, newpos1, Quaternion.identity); bullet1 projectile2 = projectileObject2.GetComponent <bullet1>(); projectile2.Launch(Vector2.up, 200); GameObject projectileObject3 = Instantiate(bullet, newpos2, Quaternion.identity); bullet1 projectile3 = projectileObject3.GetComponent <bullet1>(); projectile3.Launch(Vector2.up, 200); } if (firelevel == 5) { GameObject projectileObject = Instantiate(bullet2, rigidbody2d.position + Vector2.up * 0.2f, Quaternion.identity); bullet1 projectile = projectileObject.GetComponent <bullet1>(); projectile.Launch(Vector2.up, 200); Vector2 newpos1 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.right * 0.1f; Vector2 newpos2 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.left * 0.1f; GameObject projectileObject2 = Instantiate(bullet2, newpos1, Quaternion.identity); bullet1 projectile2 = projectileObject2.GetComponent <bullet1>(); projectile2.Launch(Vector2.up, 200); GameObject projectileObject3 = Instantiate(bullet2, newpos2, Quaternion.identity); bullet1 projectile3 = projectileObject3.GetComponent <bullet1>(); projectile3.Launch(Vector2.up, 200); } if (firelevel == 6) { GameObject projectileObject = Instantiate(bullet2, rigidbody2d.position + Vector2.up * 0.2f, Quaternion.identity); bullet1 projectile = projectileObject.GetComponent <bullet1>(); projectile.Launch(Vector2.up, 200); Vector2 newpos1 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.right * 0.1f; Vector2 newpos2 = rigidbody2d.position + Vector2.up * 0.2f + Vector2.left * 0.1f; GameObject projectileObject2 = Instantiate(bullet2, newpos1, Quaternion.identity); bullet1 projectile2 = projectileObject2.GetComponent <bullet1>(); projectile2.Launch(Vector2.up, 200); GameObject projectileObject3 = Instantiate(bullet2, newpos2, Quaternion.identity); bullet1 projectile3 = projectileObject3.GetComponent <bullet1>(); projectile3.Launch(Vector2.up, 200); GameObject projectileObject4 = Instantiate(bullet2, newpos1 + Vector2.right * 0.1f, Quaternion.identity); bullet1 projectile4 = projectileObject4.GetComponent <bullet1>(); projectile4.Launch(Vector2.up + Vector2.right * 0.1f, 200); GameObject projectileObject5 = Instantiate(bullet2, newpos2 + Vector2.left * 0.1f, Quaternion.identity); bullet1 projectile5 = projectileObject5.GetComponent <bullet1>(); projectile5.Launch(Vector2.up + Vector2.left * 0.1f, 200); } }