ReplayPuzzleGame/Assets/Scripts/Utility/CameraEffect.cs
qoralstmd6825 56667ad065 타이틀과 레벨 선택창 제작
새로운 레벨을 추가할때 씬 이름을 Level_레벨숫자 로 적고 build Setting 에서 scene 추가하기
2026-02-04 14:31:41 +09:00

23 lines
590 B
C#

using UnityEngine;
public class CameraEffect : MonoBehaviour
{
public Transform target;
public float smoothTime = 0.3f;
public Vector3 offset = new Vector3(0, 0, -10f);
private Vector3 _velocity = Vector3.zero;
void Update()
{
if (target == null)
{
target = GameObject.FindGameObjectWithTag("Player")?.transform;
return;
}
Vector3 targetPosition = target.position + offset;
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref _velocity, smoothTime);
}
}