public void ShootBullet() { var bullet = spawnBullet.Spawn(); if (transform.position.x < target.transform.position.x) { bullet.transform.position = outputGunR.transform.position; bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); } else { bullet.transform.position = outputGunL.transform.position; bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 180, 0)); } }
public void ShootBullet() { int shots = 3; while (shots >= 0) { var bullet = spawnBullet.Spawn(); if (transform.position.x < target.transform.position.x) { bullet.transform.position = outputGunR.transform.position; if (shots == 3) { bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 45)); } else if (shots == 2) { bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); } else { bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 0, -45)); } } else { bullet.transform.position = outputGunL.transform.position; if (shots == 3) { bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 180, 45)); } else if (shots == 2) { bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 180, 0)); } else { bullet.transform.rotation = Quaternion.Euler(new Vector3(0, 180, -45)); } } shots--; } shots = 3; }