private void Android_Shoot(int touchIndex) { for (int j = 0; j < weaponPrefab.Length; j++) { if (weaponPrefab[j].activeInHierarchy && bulletPrefabCount > 0) { Vector3 touch = mainCamera.ScreenToWorldPoint(Input.GetTouch(touchIndex).position); var deltaX = touch.x - firePoint[j].position.x; var deltaY = touch.y - firePoint[j].position.y; float rotationDegrees = (180 / Mathf.PI) * Mathf.Atan2(deltaY, deltaX); if ((rotationDegrees is <= 90 and >= -50) && !(chMove.IsFacingRight)) { chMove.Flip(); weaponPrefab[j].transform.localScale = new Vector3(-1f, 1f, 1f); } if ((rotationDegrees is >= 90 and >= 0) && (chMove.IsFacingRight)) { chMove.Flip(); weaponPrefab[j].transform.localScale = new Vector3(1f, -1f, 1f); } weaponPrefab[j].transform.rotation = Quaternion.Euler(0, 0, rotationDegrees); firePoint[j].rotation = Quaternion.Euler(0, 0, rotationDegrees); Instantiate(bulletPrefab[j], firePoint[j].position, firePoint[j].rotation); bulletPrefabCount -= 1; } } }