void FixedUpdate() { if (stageInfo.isStageActivated) { switch (stageInfo.GetCameraMove().cameraSlope) { case 0: return; case 1: if (!Physics.Raycast(transform.position, transform.right, 0.5f * transform.lossyScale.x, 1 << LayerMask.NameToLayer("Obstacle"))) { transform.position = Vector3.MoveTowards(transform.position, transform.position + transform.right.normalized, moveSpeed); } break; case 2: if (!Physics.Raycast(transform.position, -transform.right, 0.5f * transform.lossyScale.x, 1 << LayerMask.NameToLayer("Obstacle"))) { transform.position = Vector3.MoveTowards(transform.position, transform.position - transform.right.normalized, moveSpeed); } break; } } }
void FixedUpdate() { if (stageInfo.isStageActivated) { float rotationX = (transform.rotation.eulerAngles.x + 360) % 360; switch (stageInfo.GetCameraMove().cameraSlope) { case 0: return; case 1: transform.rotation = Quaternion.RotateTowards(transform.rotation, rightRotation, moveSpeed); break; case 2: transform.rotation = Quaternion.RotateTowards(transform.rotation, leftRotation, moveSpeed); break; } } }